Round 1 (F2F):
- Insert a node into sorted linked list and delete a node from it. Take care of all the edge cases.
- Convert an n-ary tree into it’s mirror tree. I gave a solution using recursion, he asked me to do it without recursion. Then I used queue and level order traversal. https://www.geeksforgeeks.org/mirror-of-n-ary-tree/
- Rotate Linked List by K nodes. I gave a solution using 2 pass. He asked me to traverse the list only once. https://www.geeksforgeeks.org/rotate-a-linked-list/
Round 2 (F2F):
- Find median node of a Linked List. In case of size being even, return 1st of 2 median nodes.
- Given a binary tree, print sum of all it’s node at each level.
- Implement a queue using stack. https://www.geeksforgeeks.org/queue-using-stacks/
- What are OOPS concepts ?
- difference b/w abstraction and encapsulation with examples.
- Interviewer asked what design patterns do you know and then asked me to write working code of Singleton Pattern with explanation. Why this pattern is used ?
- What are caches? Why we need them?
Hiring Manager Round:
- Given 100 machines each with 1GB of RAM and 100GB Memory, sort a file of size 100GB. Given file is a text file containing strings. Solution – we obviously have to break the file in 100 pieces as one machine has only 1GB of RAM. We can apply any sorting algorithm to sort each of the pieces. Now the real challenge is to merge the sorted files. We could use a minHeap of size 100 and push 1st string of every sorted file into the heap. Now we will perform extractMin and append the string to a output file. Now we push the next string into minHeap from the file whose content just got extracted from heap eg. if extractMin operation extracted a string from File.1, next string of File.1 will be pushed to heap. This will go on till we have pushed every string of every files. The interviewer was very helpful and gave me hints to arrive at the solution.
- Detailed discussion on my current work. He seemed very interested in the project that I was working on. He basically wanted to check how much idea do I had of the design and architecture of the systems I worked on. He gave few alternate scenarios in my project and asked me to handle those.
- Why I want to leave my current company? Why join a startup?
HR Round (Telephonic):
It went for 15 mins with usual HR question. Why PharmEasy ? Why leaving current employer? How will you manage in a startup coming from MNC etc.
This was the last round and I got selected.