Deloitte Coding Questions and Answers
Deloitte Coding Questions with Solutions
On the Deloitte Coding Questions and Answers page, you will find out all the details related to the Hiring process of Deloitte including Coding Questions asked in NLA ( National Level Assessment ) and Technical Interview, Job Profile, Salary, Job Location, and other related details.
About Deloitte
Deloitte, formally known as Deloitte Touche Tohmatsu Limited is a leading global services provider company. They provide services in consulting, financial advisory, tax management, risk management, audit, and assurance.
Deloitte is also having a Subsidiary, Deloitte US – India Consulting, which works under the Deloitte US Organization providing the same services as Deloitte US Organization gives.
About Deloitte Recruitment Process
This Hiring process consists of following steps :
- Online Assessment [ Aptitude, Verbal and Technical Based ]
- Technical and HR Interview
We have mentioned further details of Deloitte Recruitment Process in following Tabular Form for a particular Job Profile
Points | Related Informations |
---|---|
Position : | Analyst Trainee |
Course : |
|
Eligibility Criteria / Academic Qualification Required : |
Minimum 60% or equivalent CGPA of 6.5 and above |
Cost to Company (CTC) | Rs 4,50,000 /- P.A |
Selection Process : |
|
Joining Location : | Remote |
Pattern of Deloitte Recruitment Exam :
Please be aware that this National Level Assessment has a 90-minute time limit and is divided into 4 sections, which are mentioned below :
Topics | Number of Questions | |
---|---|---|
Language Skills (English) | 10 MCQs + 3 FUBs | |
General Aptitude | 12 Reasoning + 10 Quants | |
Technical MCQs | 30 Questions | |
Coding Questions | 2 Questions |
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Deloitte Coding Questions
Question 1: Class Monitor
Problem Statement :
After JEE Mains, some students got admission into an engineering college. Now there is a class consisting of such n students, and the HOD came to say it is time to select the class monitor. But He never gets all of them at one time. So he brought a register, every time he gets someone with less rank than the previous time he cut the name and wrote the name of the student and the rank.
For a given number of ranks he gets each time, you have to predict how many names are cut in the list.
Constraints:
Number of Visiting<=10^9
ranks <=10000
Input Format:
Number of Visiting N in their first line
N space separated ranks the HOD gets each time
Output Format:
Number of ranks cut in the list
Sample Input:
6
4 3 7 2 6 1
Sample Output:
3
#include <bits/stdc++.h> using namespace std; int main() { int n, p, m = INT_MAX, ans = 0; cin >> n; vector < int > a(n); for (int i = 0; i < n; i++) { cin >> p; if (p < m) { m = p; ans++; } } cout << ans - 1; }
import java.util.Scanner; public class Main { public static void main(String[] args) { int n, p, ans = 0, m = Integer.MAX_VALUE; Scanner sc = new Scanner(System.in); n = sc.nextInt(); for (int i = 0; i < n; i++) { p = sc.nextInt(); if (p < m) { m = p; ans++; } } System.out.print(ans - 1); } }
n = int(input()) a = list(map(int, input().split())) m = a[0] ans = 0 for i in range(1, n): if a[i] < m: m = a[i] ans += 1 print(ans)
Question 2 : Corona for Computer
Problem Statement :
Every decimal number can be changed into its binary form. Suppose your computer has it’s own CoronaVirus, that eats binary digits from the right side of a number. Suppose a virus has 6 spikes, it will eat up 6 LSB binary digits in your numbers.
You will have a bunch of numbers, and your machine will have a virus with n spikes, you have to calculate what will be the final situation of the final numbers.
Input Format:
First line, a single Integer N
Second line N space separated integers of the bunch of values as array V
Third line a single integer n, the number of spikes in Corona for Computer
Output Format:
Single N space separated integers denoting the final situation with the array v.
Sample Input:
5
1 2 3 4 5
2
Output:
0 0 0 1 1
Explanation:
5 is 101 in binary, when you cut the last two binary digits, its 1.
#include <bits/stdc++.h> using namespace std; int main() { int N, n; cin >> N; vector < int > v(N); for (int i = 0; i < N; i++) cin >> v[i]; cin >> n; for (auto i: v) cout << (i >> n) << " "; }
import java.util.Scanner; 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 k = sc.nextInt(); for (int i: arr) { System.out.print((i >> k)); System.out.print(" "); } } }
N=int(input()) a=list(map(int,input().split())) n=int(input()) s="" for i in a: s+=str(i>>n)+" " print(s)
Question 3 : Help of Prepsters
Problem Statement :
Arnab has given me a challenge. I have to calculate the number of numbers which are less than a certain value n, and have exactly k set bits in its binary form. As you are a Prepster like me, help me write a code that will take input for n and k and give the expected output.
Constraints :
1<=n<=10000
1<=k<=10
Input Format :
First line containing n and k space separated
Output Format :
Number of numbers present in a single line
Sample Input:
7 2
Sample Output:
3
Explanation:
11,110,101 -> These three numbers.
#include <bits/stdc++.h> using namespace std; int n, k, ans, l; map < int, int > m; void func(int i, string s, int L) { // cout<< s<< endl; if (L > l) { return; } if (i == 0 && m[stoull(s, 0, 2)] == 0) { m[stoull(s, 0, 2)]++; ans++; } if (s != "") if (n < stoull(s, 0, 2)) { return; } func(i - 1, s + "1", L + 1); func(i, s + "0", L + 1); } int main() { cin >> n >> k; char res[10000]; itoa(n, res, 2); ans = 0; l = strlen(res); func(k - 1, "1", 1); cout << ans; } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int ans = 0; for (int i = 1; i < n; i++) { if (countSetBits(i) == k) { ans++; } } System.out.println(ans); } private static int countSetBits(int i) { if (i == 0) return 0; else return 1 + countSetBits(i & (i - 1)); } }
ans = 0 n, k = map(int, input().split()) l = len(bin(n)[2:]) def func(i, s, L): global l global ans if L > l: return if i == 0: ans += 1 if s != "": if n < int(s, 2): return func(i - 1, s + "1", L + 1) func(i, s + "0", L + 1) func(k - 1, "1", 1) print(ans)
Question 4: Momentum LinkedList
Problem Statement :
Ratul made a linked list, a list made of n nodes, where every node has two variables, the velocity and the mass of a particle.
Since all the particles have the velocity in the same direction, find the total momentum of the entity made by the particles from the linked list.
Constraints :
1<=n<=10000
1<=m,v<=100
Input format:
First line containing n, number of nodes
Then n lines containing the mass and the velocity space separated.
Output Format:
Single integer denoting the momentum
Sample Input:
4
1 3
2 4
2 3
4 5
Sample Output:
37
#include <bits/stdc++.h> using namespace std; int main() { int n, s = 0, m, v; cin >> n; for (int i = 0; i < n; i++) { cin >> m >> v; s += (m * v); } cout << s; }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int s = 0; for (int i = 0; i < n; i++) { int m = sc.nextInt(); int v = sc.nextInt(); s += (m * v); } System.out.println(s); } }
n = int(input()) s = 0 for i in range(n): m, v = map(int, input().split()) s += m * v print(s)
Question 5: Lazy String
Problem Statement :
Anish is the laziest person you can ever see. He is tasked to write the name of the winner in a game where two people take part. And he just writes the longest common subsequence over there, so that with minimum chane or no backspace he can edit the name to the winner’s name.
For two given names, you have to predict what Anish will write in his computer before the start of the name. If there are more than two longest subsequences possible,write the one with less lexicographic value.
Input Format:
Two lines including two strings of name(All with capital letters)
Output Format:
A single line with the lexicographically smallest possible longest common subsequence.
Sample Input:
ABCD
BACD
Sample Output:
ACD
Exclamation:
ACD and BCD these are the two possible biggest substring
#include <bits/stdc++.h> using namespace std; string s1, s2, s3; int fun(int i, int j, int k, string s) { if (i == s1.length() || j == s2.length()) { if (s3.length() == s.length()) s3 = min(s, s3); else if (s3.length() < s.length()) s3 = s; return k; } if (s1[i] == s2[j]) return fun(i + 1, j + 1, k + 1, s + s1[i]); return max(fun(i + 1, j, k, s), fun(i, j + 1, k, s)); } int main() { cin >> s1 >> s2; fun(0, 0, 0, ""); cout << s3; }
import java.util.Scanner; public class Main { public static String s1, s2, s3 = ""; public static void main(String[] args) { Scanner sc = new Scanner(System.in); s1 = sc.nextLine(); s2 = sc.nextLine(); fun(0, 0, 0, ""); System.out.println(s3); } private static int fun(int i, int j, int k, String s) { // TODO Auto-generated method stub if (i == s1.length() || j == s2.length()) { if (s3.length() == s.length()) { if (s3.compareTo(s) > 0) { s3 = s; } } else if (s3.length() < s.length()) { s3 = s; } return k; } if (s1.charAt(i) == s2.charAt(j)) { return fun(i + 1, j + 1, k + 1, s + s1.charAt(i)); } return Math.max(fun(i + 1, j, k, s), fun(i, j + 1, k, s)); } }
s1 = input() s2 = input() s3 = "" def fun(i, j, k, s): global s1 global s2 global s3 if i == len(s1) or j == len(s2): if len(s3) == len(s): s3 = min(s, s3) elif len(s3) < len(s): s3 = s return k if s1[i] == s2[j]: return fun(i + 1, j + 1, k + 1, s + s1[i]) return max(fun(i + 1, j, k, s), fun(i, j + 1, k, s)) fun(0, 0, 0, "") print(s3)
FAQs related to Deloitte Coding Questions
Question 1: What kind of roles are available at Deloitte in India?
Deloitte offers a variety of roles across different domains like Audit, Consulting, Financial Advisory, Risk advisory, Tax and related services.
Question 2: Does Deloitte asks coding questions in there Recruitment Process?
Yes, Deloitte asks coding questions in there National Level Assessment and Technical Interview.
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
Login/Signup to comment