All the 4 rounds were technical rounds.
The round began with an introduction and a brief discussion on projects. Then the interviewer started with the questions.
I had to write the code for it on paper. The interviewer then asked me if we should continue with linked lists or move on to something else. I told him I was fine in either case.
First the question was without loops. I told him my approach. He then told me to solve it taking loops into consideration. I discussed my approach and wrote the code for it.
This round again had 2 questions.
- Find the minimum number of ‘+1’ operations to be done on an array for it to have only ‘k’ distinct elements
I initially told an O(n³) solution. He told me to optimise it. I optimised it to O(n²). He told me to try and optimise it further. I came up with an O(n) approach but it would not work for a particular case. However, the interviewer was satisfied with this and told me to write the code for it.
- Given a chemical compound, find the numbers of each atom in it.
For reference, C6H2(NO2)3(CH3)3
I told a stack-based approach, traversing the string from right to left. As time was running short, I did not have to code it.
There were 2 questions in this round.
- Given the quad tree representation of 2 images, construct the quad tree for the image formed by superimposing these 2 images.
The interviewer first explained what a quad tree is and how an image is represented in the form of a quad tree. I solved this question using a recursion-based approach.
I had to code my solution for both the questions on paper.
The round began with an introduction, followed by a detailed discussion on my projects and internship. The interviewer then moved on to questions.
I had to write the code for the first question only.
- The interviewer doesn’t expect the most efficient solution to each question right away. Instead, doing so will make it seem like you have mugged up the solution. So, start with the approach that first comes to your mind, and then optimise it further if the interviewer asks you to do so.
- After listening to the question clarify any doubts you have, else you might end up solving a wrong question and this will leave a bad impression on the interviewer.
- Make conversation with the interviewer while you are working on your approach. The interviewer may point out some mistakes and direct you the correct way.
- If you are stuck at any point, talking to the interviewer will help and you may also get some hints.
- Don’t get nervous if the interviewer is pointing out mistakes in your approach or code. The number of mistakes you make won’t matter as long as you correct them later.