Amazon Interview Experience | Set 168

Interview 1:
The interviewer asked me about my resume which was followed by the following question.Given a function mapped from integers to real numbers, which strictly increases upto a certain point say A and strictly decreases after it, write a function to find this point.The solution was a simple binary search, the trick being to reach the other side of the peak. This can be achieved iteratively increasing ‘x’ and checking for a downward slope condition. The step could be constant, but an exponential increase would let to the point faster. I was asked to prove this by giving the recurrence relation and hence showing the complexity. I was further asked to code the entire algorithm using any language of my choice where I used c.

Interview 2

The interviewer asked me about networks in relation to sockets and ports when he saw an academic project that was mentioned in my resume.
The interview questions were as follows:
1) Given a binary tree where value at each node is a single digit, find the sum of numbers generated by each root to leaf path. He also asked to code the primary function for the same. I couldn’t find the exact question on geeksforgeeks, but this one is close enough

2) Given a numpad such that every number is associated with a set of letters, give all combinations of strings that could be formed given a string of numbers. He also asked to code the primary function for the same.

Interview 3

1) Given an array of integers, find a subset of numbers from this array such that, after negating the elements of this set, the total sum of all elements would be equal to zero.
I could not solve the problem and he moved on to the next one after giving me a hint to use Dynamic Programming

2) Given two sorted arrays find the median of the merged array without using extra space. I gave an O(N) Solution and he asked me to give an O(log(N)) solution,which I gave after I put in some thought

3) Print a binary tree in a zigzag order level wise. I gave an implementation using a doubly ended queue, he wasn’t satisfied as this would lead to extra space complexity for storing the levels in the d-queue. He was pleased when I decided to use 2 queues for the same. He further asked me to code it up

Interview 4
1) The interviewer asked me about the types of database I knew and elaborated a bit on non-relational databases like mongodb and JSON.

2) Next, he asked me the need for indexing in databases and it’s implementation.

3) In an auctioning system, the bidder with the highest bid wins but charged at kth highest price. Develop a system for it. Solved it using a hashmap. Was asked to write a code for the same.

4) Given an array such that all elements except one are duplicate, find this element. He tweaked the problem to add the condition that in stead of one there are 2 such elements. I couldn’t arrive to a solution even after he gave me some hints. In the end he gave me the answer but immediately said that it may not work. I realized why it did work and explained the reason for the same.

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

Write your Interview Experience or mail it to

My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.