Qualification round (Online round held on Hackerrank) :
This round had 2 parts – coding and aptitude. There were three questions in the coding part:-
- 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.
- 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
- 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.
- 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
- 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.
- Then she asked me about some basic concepts of OOP.
- Then she gave me a problem related to the Longest Common Subsequence problem.
- She also asked me about my project on machine learning.
- 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.
- Petrol pump problem
- Explain the problem of critical section with the help of a water bottle. What is a deadlock and explain its four characteristics.
- What is thrashing and when does it occur.
- Lowest common ancestor in a BST.
- Print a given matrix in a spiral form.
- Puzzle 1 – https://www.programmerinterview.com/index.php/puzzles/8-pennies-find-lightest-7-equal/
- Puzzle 2 – https://www.mathsisfun.com/puzzles/weighing-10-bags-solution.html
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.
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 !!!