Consultadd Coding Questions and Answers

Consultadd Coding Questions with Solutions

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.

consultadd-coding-questions

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:

  1. Online Coding Test
  2. Technical Interviews [ 3 Rounds ]
  3. HR Interview

In the table below, we have provided further information on the Consultadd Recruitment Process.

ConsultaddRelated Information
Position :Software Engineer Level 1
Course :
  • B.E / B.Tech – CS & IT.
  • Eligible Batch: 2022 – 2023
Eligibility Criteria / Academic Qualification Required :
  • Minimum 65 % or equivalent CGPA required in 10th / 12th/ Graduation.
  • No Current Backlogs.
Consultadd CTC Offered :
  • During Internship = ₹ 50K
  • Post Internship = ₹ 8 – 10 L.P.A
Selection Process :
  1. Online Coding Assessment
  2. 3 Rounds – Technical Interview
  3. HR Interview
Joining Location :Pune

Skills required for Software Engineer Job profile:

  • Knowledge of a minimum of one programming language.
  • Should have excellent knowledge in Computer Science subjects like Data Structures, Algorithms, Database, Computer Networks, Operating Systems etc.
  • Good Analytical and Problem-Solving Skills.
  • Good communication Interpersonal Skills.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Consultadd Coding Questions with Solutions

Question 1 : Match

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.

Constraints :
2<_n, m<_10^5
1<_ teamA[j]<_10^9,where 0<_j<n.
1<_ teamB[i]<_10^9,where 0<_j<m


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.

Sample input 0 :
4 -> teamA[] size n = 4
1 -> teamA = [1,4,2,4]
4
2
4
2-> teamB [] size m = 2
3-> teamB = [3,5]
5

Sample ōutput 0 :
2
4

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.

Run
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);
        }
    }
}
Run
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.

Run
#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;
}
Run
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;
    }
}
Run
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.

Function has the following parameters

A: an integer

B: an integer

Constraints

  •    A will between 1 and 1,000,000 . Inclusive.
  •    B will be between A and 1,000,000. Inclusive.

Sample Input 0 

1

5

Sample Output 0

12 * 10^1

Explanation 

1*2*3*4*5=120 = 12 * 10^1

Sample Input 1

3

10

Sample Output 1

18144 * 10^2

Explanation

3*4*….*10=1814400 =18144 * 10^2

Run
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));
  }
}
Run
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.

Sample Input:

    6
    1
    3
    3
    4
    3
    3

Sample Output:

    3

Run
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;
int main()
{
    int n,a,ans=0;
    cin>>n;
    while(n--)
    {
        cin>>a;
        m[a]++;
        if(m[a]>1) ans++;
    }
    cout<<ans;
}
Run
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    TreeSet list=new TreeSet<>();
    for(int i=0;i<n;i++)
      list.add(sc.nextInt()); 
    
    System.out.println(Math.abs(n-list.size()));
 }
}
Run
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.

Run
#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;
}
Run
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);
    }
}
Run
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:-

  1. Coding Test
  2. 3 Rounds of Technical Interviews
  3. 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.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription