Round 1: This round had 3 questions. The questions were modifications of the below problems
- Given a set of N strings is said to be GOOD SET if no string is a prefix of another string else, it is BAD SET. (If two strings are identical, they are considered prefixes of each other.). Print if a given set of strings is a GOOD SET or BAD SET. This question had to be solved using Tries.
- 2nd question was similar to the ‘Ugly Numbers‘ Problem.
- Longest common subsequence Problem.
37 students were shortlisted after this round.
Round 2: I was asked a single question in this round. The question was – An array of 8 elements is given with values 0,1. It undergoes N transitions. Find the state of the array after Nth transition where a transition is defined as –
An element of the array will be 1 in the next state if both of its neighbours are same otherwise it will be 0.(first and last elements have single neighbour so they will become 0 after the first iteration irrespective of the value of their neighbour.)
I gave an approach in which state of array after single transition can be calculated in O(1) time complexity because no of elements in the array is only 8, so we can iterate over each element in the array and look at its neighbours to find the state of this element. Similarly, we can calculate the state of the array after each transition and state after the Nth transition can be found in O(N). The interviewer asked me to improve the time complexity further, but I was not able to think of an approach, so I asked for hints. He told me to dry run a sample example as a hint but I still couldn’t find an optimised solution, so I asked for another hint. He told me that there will be a pattern and after that the states will start repeating, so we can store the states and when we found a state that has already been seen then we can stop calculating more states and using the stored states we can calculate Nth state because states will be repeating with a period.
The interviewer was very friendly and was constantly discussing.
Round 3: Firstly the interviewer asked me to introduce myself and asked me to describe briefly about my projects. Then he asked me what is a deadlock and how can a deadlock be prevented. He asked me OS, OOPS and DBMS questions like – the difference between a thread and a process, operator overloading, indexing in DBMS.
He then asked me to explain about AVL trees, B+, B trees and the difference between a B+ and B tree.
NOTE- All the rounds were virtual and took place on Google meet because of the current COVID-19 situation.
Tips: Just stay calm and confident. If you are unable to think of an optimised solution start with brute force and ask for hints. In most of the interviews, the interviewer is always ready to help, and he also tries to build a solution with you. Don’t Panic and believe in yourself!