The first round had 20 multiple choice questions covering C programming, Data structures, Algorithms, Maths and puzzles, and a question from Networking and Operating systems. The duration of the test was of 90 minutes and marking scheme was +1, -0.25

It also had 2 coding questions.
i) Given an array of numbers, find the minimum value of the absolute difference that can be obtained from any pair of numbers from the array.

ii) Find the first non-repeated character in a string. If there are no such chars then return -1.

There were 4 rounds of technical interview, no HR round. Following are the major questions asked to me in the tech rounds. I had to first suggest the logic, discuss that with the interviewer and then he asked me to code it up.

Round 1 –
1) Check if a given tree is a Binary Search Tree or not. Simple enough question.

2) You are given an array whose each element represents the height of the tower. The width of every tower is 1. It starts raining. How much water is collected between the towers?
Eg. [1,5,3,7,2] – then answer is 2 units between towers 5 and 7.
Looks easy, but if you don’t observe well, then you might end up with the wrong logic like I did at first. Also there are lots of possible corner cases. Luckily I could identify them all.

3) Given an array and a fixed window size X, you have to find out the minimum value from every window. De-queue was not allowed. So I had to do it using 2 stacks.

Round 2 –
1) Some DBMS questions like how is database stored in memory,how an image stored in database and a few more questions from it.

2) What is a height balanced tree. Give an O(n) solution to balance it. Then he changed the definition of a balanced tree as- a tree is balanced if every node in a particular level should have the same number of descendants (and not only direct children). And every node can have any number of children. I had to design the class and then write the code for it.

3) Given an array of integers, find an index such that if you split the array into two parts the absolute value of the difference between the sum of elements in both parts had to be minimum. After giving him the logic, he changed it to split it into 3 parts such that sum of elements in all of them are equal. I had to code this one.

Round 3 –
1) There is a sentence that your friend knows, but while giving it to you, he lost all the spaces. You have to dictionary with you. How would you reconstruct the original sentence using it.

2) How to delete a particular node from a circular Linked list.

3) You are given an encrypted file. You don’t know the key used to encrypt it. Like A might be mapped to B, B to some D and D to some other F. But you don’t know this encryption scheme. You have the dictionary with you. How will you decrypt the file? I suggested lots of solution like exhaustive searching, then using some variants to minimize the complexity. He gave me just a one word hint- histogram. So I gave him a logic that counting the frequency of every letter used in the dictionary. Then replace the most used letter in the file with the most used in the dictionary. And then compare words with the dictionary. In case of a mismatch back –track and use the second largest and so on. I also discussed with him that it could also have high complexity in worst case, but he moved on.

4) What is indexing in DBMS. How will you implement an index.

Round 4 -
1) A complete path in a tree is from a root to a leaf. A k-heavy path is a complete path whose sum of elements is greater than k. Write a code to delete all nodes which are not in any of the k-heavy paths.

2) You have an array whose elements firstly strictly increase and then strictly decrease. You have to find the point of change.

All the questions in all the rounds required the minimum possible complexity possible (both time and space). And I had to write the code of my final solution as well. Finally the results came and I was selected by them.

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.