On this page, you will get Consultadd Coding Questions and Answers, which were asked in Online Coding Test and Technical Interviews included in Consultadd Recruitment Process.
Apart from that you will get the details on Condultadd Recruitment process including CTC Offered, Eligibility Criteria, and Job Profile.
About Consultadd
Consultadd is a global IT services and solutions company that provides customized software development, data management, and consulting services to businesses of all sizes. They specialize in digital transformation, artificial intelligence, machine learning, and cloud computing, and offer end-to-end solutions for their clients. The company is headquartered in New Jersey, USA, and has offices in India, Canada, and the UK.
About Consultadd Recruitment Process
Consultadd Recruitment Process involves 3 steps for hiring the applicants:
Online Coding Test
Technical Interviews [ 3 Rounds ]
HR Interview
In the table below, we have provided further information on the Consultadd Recruitment Process.
Problem Statement : The number of goals achieved by two football teams in matches in a league is given in the form of two lists. For each match of team B. Compute the total number of matches of team A where team A has scored less than or equal to the number of goals scored by team B in that match.
Example : team A =[ 1,2,3] team B =[ 2,4] Team A has played three matches and has scored team A =[1,2,3] goals in each match respectively. Team B has played two matches and has scored team B = [2,4] goals in each match respectively. For 2 goals scored by team B in its first match, team A has 2 matches with scores 1,2 and 3 hence , the answer is [2,3].
Function Description :
Complete the function counts in the editor below.
Counts has the following parameters: int teamA(n): First array of positive integers int teamB(m): Second array of positive integers
Return : int(m): an array of m positive integers, one for each teamB[i] representing the total number of elements from teamA[j] satisfying teamA[j]<_ teamB[i] where 0<_j<n and 0<_i< m, in the given order.
Input format for custom Testing : Input from stdin will be processed as follows and passed to the functions.
The first line contains an integer n, the number of elements in teamA. The next n lines each contain an integer describing teamA[j] where 0<_j<n. The next line contains an integer m, the number of elements in teamB. The next m lines each contain an integer describing teamB[i]where 0<_i<m.
Explanation 0 : Given values are n =4, team A = [1,4,2,4], m= 2, and teamB = [3,5]. For teamB[0] = 3, we have 2 elements in teamA(teamA[0] = 1 and teamA[2] = 2) that are <_ teamB[0]. For teamB[1] = 5, we have 4 elements in teamA(teamA[0] = 1, teams[1] =4, teamA[2] = 2, and teamA[3] =4) that are <_teamB[1]. Thus , the function returns the array [2,4] as the answer.
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int teamA[] = new int[n];
for (int i = 0; i < n; i++)
teamA[i] = sc.nextInt();
int m = sc.nextInt();
int teamB[] = new int[m];
for (int i = 0; i < m; i++)
teamB[i] = sc.nextInt();
Arrays.sort(teamA);
int count = 0;
for (int i = 0; i < m; i++) {
count = 0;
for (int j = 0; j < n; j++) {
if (teamA[j] <= teamB[i])
count++;
else
break;
}
System.out.println(count);
}
}
}
ar=list(map(int,input().split()))
br=list(map(int,input().split()))
ar.sort()
ans=[]
import bisect
for i in br:
ans.append(bisect.bisect(ar,i))
print(ans)
Question 2 : Share Holder (R -> Hard)
Problem statement :
Ratan is a crazy rich person. And he is blessed with luck, so he always made the best profit possible with the shares he bought. That means he bought a share at a low price and sold it at a high price to maximize his profit. Now you are an income tax officer and you need to calculate the profit he made with the given values of stock prices each day. You have to calculate only the maximum profit Ratan earned. Note that: Ratan never goes into loss.
Example 1 :
Price=[1,6,2] Ratan buys it on the first day and sells it on the second.
Example 2 :
Price=[9,8,6]
The Price always went down, Ratan never bought it.
Input Format: First line with an integer n, denoting the number days with the value of the stack Next n days, telling the price of the stock on that very day.
Output Format: Maximum profit done by Ratan in a single line. Constraints: Number of days <=10^8
Sample Input for Custom Testing
STDIN ———– 7 1 9 2 11 1 9 2
Sample Output
10
Explanation
The maximum profit possible is when Ratan buys it in 1 rupees and sells it in 11.
#include <bits/stdc++.h>
using namespace std;
int solve(vector < int > v) {
int n = v.size();
if (n == 0)
return 0;
int mx = v[0];
for (int i = 1; i < n; i++)
mx = max(mx, v[i]);
if (mx <= 0)
return 0;
int mxSum = 0;
int cSum = 0;
for (int i = 0; i < n; i++) {
cSum += v[i];
if (cSum < 0) cSum = 0; mxSum = max(mxSum, cSum); } return mxSum; } int main() { int n; cin >> n;
int price[n];
for (int i = 0; i < n; i++) cin >> price[i];
vector < int > diff;
for (int i = n - 2; i >= 0; i--) diff.push_back(price[i + 1] - price[i]);
int ans = solve(diff);
if (ans < 0) cout << 0 << endl;
else cout << ans << endl;
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int price[] = new int[n];
for (int i = 0; i < n; i++) {
price[i] = sc.nextInt();
}
Vector < Integer > diff = new Vector < > ();
for (int i = n - 2; i >= 0; i--) {
diff.add(price[i + 1] - price[i]);
}
int ans = solve(diff);
if (ans < 0) {
System.out.println(0);
} else {
System.out.println(ans);
}
}
private static int solve(Vector < Integer > v) {
int n = v.size();
if (n == 0) {
return 0;
}
int mx = v.get(0);
for (int i = 1; i < n; i++) {
mx = Math.max(mx, v.get(i));
}
if (mx <= 0) {
return 0;
}
int mxSum = 0, csum = 0;
for (int i = 0; i < n; i++) {
csum += v.get(i);
if (csum < 0)
csum = 0;
mxSum = Math.max(csum, mxSum);
}
return mxSum;
}
}
def func(diff):
n=len(diff)
if n==0:
return 0
mx=max(diff)
if mx <= 0:
return 0
mxS=0
cS=0
for i in diff:
cS+=i
if cS <= 0:
cS=0
mxS=max(cS,mxS)
return mxS
n=int(input())
arr=[]
diff=[]
ans=[0]
for i in range(n):
arr.append(int(input()))
for i in range(n-1):
diff.append(arr[i+1]-arr[i])
ans=func(diff)
if ans < 0:
print("0")
else:
print(ans)
Question-3: Formatting large Products
Rohan is weak in mathematics.He is giving mathematics Olympiad , but he got stuck in one of the question .Help rohan to solve the question.In Question there are two positive integer A and B. You have to find the product of all integer between A and B which is represented in the form C=D*10^E , where C is the product of numbers , D and E are non-negative integers and the last digit of D is non-zero.
Function Description
Complete the function formatProducts in the editor below, formatProduct must return a string that represents C in the above described form.
import java.util.*;
public class Main
{
public static String formatProducts (int a, int b)
{
int result = 1;
for (int i = a; i <= b; i++)
result = result * i;
int temp = result;
int power = 0;
while ((result % 10) == 0)
{
power = power + 1;
result = result / 10;
}
return result + " * 10^" + power;
}
public static void main (String[]args)
{
Scanner sc = new Scanner (System.in);
int a = sc.nextInt ();
int b = sc.nextInt ();
System.out.println (formatProducts (a, b));
}
}
def formatProducts(L,H):
a=1
for i in range(L,H+1):
a=a*i
c=0
while(True):
if a%10!=0:
break
else:
c+=1
a=a//10
return (str(a)+" * 10^"+str(c))
L=int(input())
H=int(input())
print(formatProducts(L,H))
Question 04 : Duplicates
Problem statement : The principal has a problem with repetitions. Everytime someone sends the same email twice he becomes angry and starts yelling. His personal assistant filters the mails so that all the unique mails are sent only once, and if there is someone sending the same mail again and again, he deletes them. Write a program which will see the list of roll numbers of the student and find how many emails are to be deleted.
def countDuplicate(numbers):
c=0
for i in set(numbers):
if numbers.count(i)>1:
c+=numbers.count(i)-1
return c
n=int(input())
numbers=[]
for i in range(n):
numbers.append(int(input()))
print(countDuplicate(numbers))
Question 5 : Coin Game (R->Medium)
Problem Statement :
Raman was playing a game, he starts with x coins. Now in every step, he wins and loses and he has to get the money or pay the money as needed. He came in contact with a psychic who can see the future and the Psychic predicted the outcomes after each step. Now Raman wants to start the game with the minimum wage where he doesn’t run out of money. Help Raman to find what money he should start with. The only rule to keep playing is not going in a credit situation.
Input Format:
First line with n, number of steps in the game Next n lines, n integers denoting outcomes of every game. Positive means winning and negative means losing that money.
Output Format:
One single integer denoting the minimum amount to start with
Constraints:
Number of steps<=10^9 -1000<=Money needed in each step<=1000
Sample Input:
4 2 -9 15 2
Sample Output:
7
Explanation:
If he starts with 7 rupees, then after steps : 7 ->9 -> 0-> 15 -> 17.
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
int sum = 0, ans = 0;
for (int i = 0; i < n; i++) {
sum += a[i];
if (sum < 1) {
sum = -sum;
ans += sum;
sum = 0;
}
}
cout << ans << endl;
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int arr[] = new int[n];
for (int i = 0; i < n; i++)
arr[i] = sc.nextInt();
int sum = 0, ans = 0;
for (int i = 0; i < n; i++) {
sum += arr[i];
if (sum < 1) {
sum = -sum;
ans += sum + 1;
sum = 1;
}
}
System.out.println(ans);
}
}
n = int(input())
arr = []
for i in range(n):
arr.append(int(input()))
s, a = 0, 0
for i in arr:
s = s + i
if s < 1:
a = a + (-1 * s)
s = 0
print(a)
FAQs related to Consultadd Coding Questions
Question 1: How many rounds are there in Consultadd Recruitment Process?
There are total of three rounds in the Consultadd Recruitment Process which include:-
Coding Test
3 Rounds of Technical Interviews
HR Interview
Question 2: Does Consultadd asks coding questions in Recruitment Process?
Yes, Coding Questions are included in Online Coding Test and Technical Interview of Consultadd.
Question 3: What kind of roles are available at Consultadd India?
Consultadd India offers a variety of roles across different domains, including software development, data management, artificial intelligence, machine learning, cloud computing, and project management. They also hire for different levels of experience, from entry-level positions to senior roles.
Question 4: How can I apply for a job at Consultadd India?
You can visit the Careers page on the Consultadd India website to browse current job openings and apply online. Or you can contact your College’s Training & Placement Cell to give necessary details of On Campus Hiring.
Login/Signup to comment