• Difficulty Level : Hard
• Last Updated : 10 Jan, 2019

Qualification round (Online round held on Hackerrank) :

This round had 2 parts – coding and aptitude. There were three questions in the coding part:-

1. There are n cities in a circle and distance between every adjacent pair of cities was given. We were asked to determine a pair of cities such that the minimum distance to travel between them is maximum.
2. There are n (n was even) people sitting on a circular table. We had to find the number of ways such that each person shook exactly one other person’s hand such that there is no crossing of handshakes. Link – https://practice.geeksforgeeks.org/problems/handshakes/0
3. A directed weighted graph consisting of N nodes was given where at each node there was a hostage. A source and destination node were also provided. N soldiers started from the source node and each soldier had the job to save exactly one hostage. The cost of saving one hostage was the sum of the weights in the path from source node to the node where the hostage is held and then to the destination node which the soldier took. We had to minimize the total cost of saving all the hostages.
I used Dijkstra’s algorithm to solve it but made some mistake and it ran partially.

Round 1:

1. The interviewer gave me an arithmetic expression (infix) and told me to convert it into postfix and then asked me to write an algorithm for it on a blank paper. Same for converting
postfix to infix.
Infix to Postfix
2. I had written a project on analysis of sorting algorithms, she asked me about all the best case and worst case examples of all the sorting algorithms that I had written.
4. Then she gave me a problem related to the Longest Common Subsequence problem.

Round 2:

1. Find the nth element in k-Fibonacci series (an element is the sum of previous k elements). First I gave a O(n) time complexity and O(n) space complexity approach and after some time gave O(n) time complexity and O(k) space complexity approach using a queue.
2. Petrol pump problem
3. Explain the problem of critical section with the help of a water bottle. What is a deadlock and explain its four characteristics.
4. What is thrashing and when does it occur.

Round 3:

1. Lowest common ancestor in a BST.
2. Print a given matrix in a spiral form.
3. Puzzle 1 – https://www.programmerinterview.com/index.php/puzzles/8-pennies-find-lightest-7-equal/
4. Puzzle 2 – https://www.mathsisfun.com/puzzles/weighing-10-bags-solution.html

Round 4:

In this round, the interviewer asked me each and every small thing about my machine learning project and at the end gave me one question.

1. Median in a stream of integers (running integers)

Round 5 was HR round and after that, they told me I was selected. GeeksforGeeks helped me a lot in preparing for Adobe, Thank you GeeksforGeeks !!!

My Personal Notes arrow_drop_up