Round 1: Online Coding Round (1hr 45 mins on Hackerearth)
This round had 5 MCQs with negative marking related to the time complexities and popular programming algorithms and 3 Coding Questions –
Ques 1 (75 Points): You are given an integer N (1<=N<=10^18) the number of nodes in a complete binary tree where node i had 2*i and 2*i+1 as its children and 1 as the root node, you had to answer Q (1<=Q<=10^5) queries. Each Query had an integer k, you had to return the number of leaf nodes in the subtree k of the binary tree.
Sample Output – 3 2
Ques 2 (100 Points): Given an array of N elements and an integer K, find the maximum number of elements in any subset of the array such that the average of the elements is less than K. (Hint: This is an application of binary search and prefix array sums)
Ques 3 (100 Points): Given a non-decreasing array of N elements(1<=N<=10^5), remove K elements from it (1<=K<=N-2) such that the maximum of the difference between the consecutive elements is minimum. (Hint: You can observe that the answer will be optimal only if we remove elements from the left or from the right but not from the middle i.e you have to find the minimum from the maximum of consecutive differences of the elements in windows of length N-K, this is an application of- print the maximum in a window of size M in an array).
About 14 students were shortlisted for the next round. Those who did at least 2 Coding questions were shortlisted.
Round 2: Personal Coding Interview 1
A lot of programming questions were asked in this interview. Few were- write pseudo code to check if a given vector of strings is sorted or not, alien dictionary, topological sorting, delete node from a double linked list in O(1) expected time complexity, find the maximum sum rectangle in a 2D array (an application of Kadanes algorithm to 2D rectangle) both naive(O(n^2 m^2)) and optimized (O(n^2 m)) solutions were asked. I was not able to get the optimum solution at that time. Few more questions related to data-structures like the unordered map, ordered map, and their complexities were also asked.
6 students were selected for the next round.
Round 3: Personal Coding Interview 2
In this round questions related to AVL tree rotations, time complexities for updations in Binary Segment tree, and K-degree segment tree, K-degree B-Trees (Balanced Search Trees), printing the permutations of a vector with distinct elements and then with duplicates were asked. I was also asked to code quick sort, its worst and best complexity, and why it can’t be solved in less than O(nlogn).
Round 4: The HR round
This round had a normal discussion about my projects, the challenges I faced, my hobbies and my career goals, etc were there.
The interviewers were very friendly and understanding. The time given to solve the questions in the coding rounds were strict. Students with experience in competitive programming had an edge there. Strong hold on data structures and algorithms will help you a lot. Most of the coding questions involved an indirect application of popular interview questions so a little practice and clear approach for those problems can help you a lot.
Only one was finally selected for the Internship. Now it’s your turn to give a try to this interview and make it to the final.
Remember, you are your own god!
All the best!