Deloitte Coding Questions: Top 5 Coding Questions for Freshers
Deloitte conducts rigorous coding assessments during recruitment to evaluate candidates' technical skills and problem-solving abilities. These assessments are vital for both freshers and experienced professionals, ensuring they have the necessary programming knowledge and analytical thinking for various roles. This article covers Deloitte coding question types, sample questions, and preparation strategies.
Types of Deloitte Coding Questions
Deloitte coding questions can generally be categorized into the following areas:
Type | Description | Examples |
---|---|---|
Data Structures | Questions focused on using data structures effectively. | Arrays, Linked Lists, Stacks, Queues |
Algorithms | Involves implementing and analyzing algorithms. | Sorting algorithms, Searching algorithms |
Problem-Solving | Logic-based questions that require critical thinking. | String manipulation, Combinatorial problems |
Dynamic Programming | Questions that involve optimizing recursive solutions. | Fibonacci sequence, Knapsack problem |
System Design (Advanced) | For experienced candidates, focusing on large-scale systems. | Designing a URL shortener, Chat application |
Deloitte Interview Coding Questions for Freshers
For freshers, Deloitte often asks questions that test basic programming skills, problem-solving capabilities, and understanding of algorithms and data structures. Here are some examples:
Question Type | Sample Question | Skills Assessed |
---|---|---|
Data Structures | Write a program to reverse a linked list. | Linked Lists, Pointers |
Algorithms | Implement a binary search algorithm. | Searching Algorithms, Efficiency |
String Manipulation | Given a string, check if it is a palindrome. | String Handling, Logic |
Sorting Algorithms | Write a function to sort an array using Quick Sort. | Sorting Techniques, Recursion |
Dynamic Programming | Find the nth Fibonacci number using memoization. | Dynamic Programming, Recursion |
Top 5 Sample Coding Questions for Deloitte
Problem Statement 1: John and Mocha are two friends. Mocha made his dictionary of length n with strings k1, k2 .. kn and called it Alien dictionary. John tries to test Mocha's Alien dictionary by giving one string s to Mocha. Help Mocha check if John's string can be segmented into a sequence of one or more words from Mocha's Alien dictionary.
Note: The words in the dictionary contain unique words of lowercase English letters and can be found multiple times in the segmentation.
Input Format:
The first line contains a string s given by John.
The second line contains n, which is the length of the dictionary of strings of Mocha.
The following n lines are different strings that are present in the Mocha's Alien dictionary
Output Format:
Print "true" if the string given by John can be segmented into a sequence of one or more words of Mocha's Alien dictionary.
Else, print "false".
Constraints:
1<= s.length() <= 3*10^2
1<= n <= 10^3
1<= ki.length() <= 20
Sample Input:
applepenapple
2
apple
pen
Sample Output:
true
Solution 1: C++
Solution 2: Python
Solution 3: Java
Problem Statement 2: Alice is given two integers, ( P ) and ( N ), where ( P ) is a prime number. She needs to find the smallest number ( X ) that is a multiple of both ( P ) and ( N ).
Input Format
The input consists of two space-separated integers, ( P ) and ( N ).
Output Format
Return the smallest possible value of ( X ).
Constraints
1 <= P, N <= 10^9
Testcase Input
2 5
Testcase Output
10
Solution 1: Python
Solution 2: Java
Problem Statement 3: You are given an array nums of integers of length n that represents the inorder traversal of a balanced binary search tree (BST). Your task is to construct this BST from the given array and return its level order serialization.
A balanced BST is a tree in which the depth difference between the two subtrees of any node is not more than 1. If there are multiple possible balanced BSTs based on the given array, you should construct the tree that has more nodes as a left child than as a right child.
Note: nums is sorted in a strictly increasing order and 'null' values of level order serialization are not included in the final output.
Input Format
The first line of input contains N representing the number of nodes in the BST. The second line of input contains N integers , separated by space, representing the inorder traversal of the required balanced BST.
Output Format
Output a string representing the level order serialization of the constructed BST, where 'null' values are not included.
Constraints
1 <= n <= 10^4
-10^4 <= nums[i] <= 10^4
Testcase Input
20
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9
Testcase Output
-1 -6 4 -9 -4 1 7 -10 -8 -5 -3 0 2 5 8 -7 -2 3 6 9
Sloution 1: Python
Solution 2: C++
Solution 3: Java
Problem Statement 4:
You are given an array ‘arr’ of positive integers. You are also given the array queries where queries[i] = [lefti, righti]. For each query I compute the XOR of elements from left to right (that is, arr[left] XOR arr[left + 1] XOR ... XOR arr[right] ). Display an array answer where answer[i] is the answer to the ith query.
Input Format
The first line contains the number of elements in the array, n.
The second line contains n space-separated integers representing the array
The third line contains the number of queries, q
The fourth line contains the number of columns in the queries matrix which is always 2.
The next q lines contain the queries where there are two space-separated integers representing left and right.
Output Format
Display a single line containing q space-separated integers representing the answer to each query.
Constraints
1 <= arr.length, queries.length<= 3 ^ 104
1 <= arr[i] <= 109
queries[i].length == 2
0 <= lefti<= righti <arr.length
Testcase Input
4
4 8 2 10
4
2
2 3
1 3
0 0
0 3
Testcase Output
8
0
4
4
Solution 1: C++
Solution 2: Java
Solution 3: Python
Problem Statement 5: Leo is fascinated by the concepts of Greatest Common Divisor (GCD) and Least Common Multiple (LCM). Alice gives him an array and challenges him to find how many pairs (i, j) in the array satisfy a particular condition. Leo defines GL(i, j) as the difference between LCM(A[i], A[j]) and GCD(A[i], A[j]), where i and j are indices of the array and 0<=i < j < N.
Your task is to help Leo count how many pairs (i, j) in the array satisfy GL(i, j) = 0. Return the total number of such pairs
Input Format
The first line contains an integer N, representing the size of A.
The next line contains N space-separated integers, representing the original array A.
Output Format
Return the total number of pairs with GL(i,j) = 0.
Constraints
1 ≤ N ≤10^5
1 ≤ A[i] ≤100
Testcase Input
2
4 7
Testcase Output
0
Solution 1: Java
Solution 2: C++
Preparing for the upcoming Deloitte exam? Click here to practice coding related problem statements so that you excel in this exam.
Deloitte Coding Questions for Freshers: Preparation Tips
To effectively prepare for Deloitte coding interviews, follow these strategies:
Preparation Strategy | Description |
---|---|
Understand Basics | Ensure a solid understanding of data structures and algorithms. |
Mock Interviews | Participate in mock interviews to simulate real interview conditions. |
Review Previous Questions | Analyze past Deloitte coding questions to identify common patterns. |
Strengthen Problem-Solving Skills | Work on logical reasoning and analytical thinking through puzzles and challenges. |
Disclaimer: While we have gathered as much information from Deloitte's official website as possible, we have also included sources gathered from available online sources. Therefore, readers are advised to check and stay updated with the official website.
Conclusion
Deloitte coding interviews can be tough, but with the right approach, you can ace them. You’ve learned about the recruitment process, common questions, and effective strategies to prepare. Remember, practice is key. The more problems you tackle, the more confident you'll feel. Your success depends on your preparation. Get ready to impress Deloitte with your coding prowess!
Frequently Asked Questions (FAQs)
1. What types of coding questions are asked in Deloitte interviews?
Deloitte typically asks questions on data structures, algorithms, string manipulation, sorting techniques, and dynamic programming.
2. What programming languages are allowed for Deloitte's coding assessments?
Candidates can usually choose from popular languages such as Python, Java, C++, and JavaScript.
3. Are coding assessments mandatory for all Deloitte roles?
Yes, for most technical roles, coding assessments are a crucial part of the recruitment process, especially for software engineering and consulting positions.
4. How should freshers prepare for Deloitte coding interviews?
Freshers should focus on practising coding problems and strengthen their understanding of data structures and algorithms.
5. Does Deloitte conduct technical interviews after the coding assessment?
Yes, candidates who pass the coding assessment typically go through further rounds of technical interviews to assess their deeper knowledge and problem-solving skills.
Suggested reads:
-
TCS Digital Recruitment Process: Latest Updates & Tips for Freshers
-
HCL Logical Reasoning Questions and Answers: Top 5 Sample MCQs
-
HCL Aptitude Test: Top 5 Questions and Answers for Freshers (MCQs)
-
Latest Capgemini English Test Questions and Answers for Freshers
-
Deloitte Verbal Test: 5 Best Questions and Answers in MCQ format