Round 1: Online Test (Duration : 2 hours 30 minutes)
- It had around 20 Multiple Choice Questions related to fundamentals of Computer Science and 2 Programming questions.
- The Programming questions were :
- Around 30 students were selected for the second round.
Round 2: 1st F2F Round (Duration : 50-55 minutes)
- Started off with the usual “Tell me something about yourself.” The Interviewer was very friendly.
- He asked me about several types of Tree-based Data Structures and their properties. (T’s, BT’s, BST’s, AVLT’s, etc.)
- He asked me to write a function that takes the Root Node of a Tree as an input, returns 1 if the tree is a BST and 0 otherwise.
- I gave him a linear approach with O(n) time-complexity and O(log(n)) or O(height of the tree) extra stack-space complexity. He was satisfied with it.
- He gave me an array consisting of only 0’s, 1’s and 2’s and asked me to sort it.
- I gave him the counting sort approach with O(n) time-complexity and O(1) extra space. He asked me if I could do it in one pass.
- I tried for some time and with the help of few hints I was able to code-out a segregative approach. Related Articles (3-Way QuickSort (Dutch National Flag))
- He gave me a weird array of size N where N-1 elements occur K times. The remaining one element occurs only 1 time. Find that one element which occurs only 1 time.
- I gave him a hashing based solution with time and extra-space complexity of O(n). He then asked me how std::unordered_map and std::map are implemented underneath. I briefed him about them. He then asked me if I could do the problem in O(n) time and O(1) extra-space.
- He told me to think in terms of bits. Then by taking some examples I was able to arrive at the solution. An example where K = 3 (Find the element that appears once)
- He then asked me some questions related to Gujarat (my native place). How good is food, tourist places, traveling and all. This discussion went on for 10 minutes. Then he asked me about some good places to eat in Jaipur (my college was in Jaipur). I gave a few suggestions. He was very friendly and even told me that I’m sending you for the second F2F round.
Round 3: 2nd F2F Round (Duration : 50-55 minutes)
- The usual “Tell me something about yourself.” I told him I was the best Counter-Strike player of the Batch and he was intrigued. He asked if I knew how the game worked. I was able to give him satisfactory information.
- He asked me to brief him about my previous round, what were my approaches to the questions.
- He asked me about the basic idea of Dynamic Programming. He asked me about my thoughts on “Where? and How? are Graphs useful in tackling real world problems.”
- He asked me whether I know about Segment Trees and Fenwick Trees or Binary-Indexed Trees and about their implementations. He didn’t ask me to code them.
- He gave me an Graph in the form of Adjacency Matrix and a separate array A for values of the nodes. He told me to transform the array A according to the following transformation :
- The new node values should be equal to the sum of product of the sum of odd-value nodes and the sum of even value-nodes in the sub-graph of that node and the node-value itself. i.e. (new_node_val = old_node_val + PRODUCT(SUM(odd_node_value nodes in the subgraph), SUM(even_node_value nodes in the subgraph) ) )
- A gave him a simple DFS approach. He told me that I was the first one who gave me the solution and was satisfied.
- He told me that we want to answer Q queries (Q <= 1e4). In each query, we will be given a number N (N <= 1e4) and we have to return 1 if N can be expressed as sum of powers of numbers less than X (X <= N). Also anything power 1 is not allowed (Otherwise there’s no point in solving as N can always be expressed as N^1). E.g for N = 242 and X = 7 : return 1 (as 242 = 1^2 + 3^2 + 6^3 + 2^4).
- He gave me a hint to see how many numbers in total can you can use to express N. Total Numbers = (2^2, 2^3, …… 2^(log2(N)), 3^2, 3^3, ……, 3^(log3(N)), ……, X^2, X^3, ……, X^(logX(N))). This turned out to be very few.
- At this point I was able to reduce the problem to finding a subset with a given sum (here N). I gave him DP solution and he was satisfied. Related Articles Subset Sum Problem
- Around 7 people were selected and I was glad I could make it. It turned out to be great experience from my side. The Interviewers were very friendly and helpful.
My Personal Notes arrow_drop_up