Amazon Pune Pool Campus Interview

Amazon pool campus placement drive was conducted in March 2019. There were total five rounds, first round being an online coding round was held on Hackerearth followed by three technical interviews and one bar raiser cum technical round.

Online Round

There were 2 coding problems and 10 MCQs related to Operating System and DBMS.

Technical Interview 1

Problem 1

You are given two integers n, k, and an array a of size n. Find out the frequency of k in the array a.


My first solution was to hash the frequency of the entire array in array h and then print h[k]. The time and space complexity are both O(n) in this case. The interviewer asked me to improve the space complexity.

In my next solution, I just took an integer variable count and incremented it every time k occurred while traversing the array a. This space complexity reduced to O(1) and time complexity still O(n).

He told me that if the array is sorted and now I have to reduce the time complexity as well. I could simply use lower_bound() and upper_bound() functions in C++ to find the first and last occurrence of k in array a. Now the space complexity is O(1) and time complexity is O(log(n)). He told me to write the code.

Instead of using upper_bound() and lower_bound() directly I thought it would be better to implement them. So, I wrote two binary search codes, one for lower_bound() and other for upper_bound(). He was satisfied and moved on to next question.

Problem 2

Create a binary search tree from a sorted linked.


My first solution was an obvious skewed tree. He was impressed and told that it is indeed very easy and simple solution but now he wants a height balanced tree. This the solution. He told me to write the entire code which I did somewhat correctly with his help.

Technical Interview 2

My second round was conducted by a very pretty and intelligent young lady. She helped me a lot, by giving suggestions and ideas to improve my solution.

Problem 1

You are given a binary tree and two integers k and d. Print all the nodes at a distance of d from k.


My first solution was to find the distance of every node from node k using LCA and then print only those nodes whose distance is d. This is my idea. The time complexity of my solution was O(nlog(n)). She wanted it in
O(n). This was the expected solution. She helped me build all the logic and finally I was told to write the code.

Problem 2

You are given an array a which consists of only 0, 1 and 2. You have to sort the array.


My first solution was to hash the frequency of the array in one traversal and then fill 0s, followed by 1 and then 2s in second traversal. She was satisfied but wanted it in single traversal. This is the solution. I was told to write the code.

Technical Interview 3

This was more of a general discussion on various fields of computer science rather than problem solving round.

Problem 1

You have a two files a.txt and b.txt having two numbers with upto billion digits. You have to calculate the sum of two numbers.


My solution was to first move the file pointer of the both files at the end and then start adding the digits and carry and consequently moving backwards and store the result into a new file. Finally create another file and save the reversed contents of previous result file. He was satisfied but then restricted the backward traversal. I told that we can use recursion to return the carry. He asked if any data structure can be used for this problem. I replied with linked list, because large amount of continuous memory cannot be allocated but linked list does not use continuous memory.

Problem 2

You are given a grid of alphabets. You have to print the coordinates of all the starting points from where word ‘AMAZON’ can be formed. You can move up, down, left and right.


I gave a solution using DFS and DP. It was difficult to explain but I tried my best. I guess he was expecting a more simpler solution but he was satisfied. He told me to write the code my idea.

Technical cum Bar Raiser Round

I was told give brief description about myself and my projects. He asked my role in the project. After which he gave two problems to solve.

Problem 1

You are given a binary tree and a node k. Find out if the left sub tree of k is a mirror image of right sub tree or not.


The idea was a modification of this.

Problem 2

You are given a character array. You have to return a character array in which each alphabet x is present min(frequency(x), position of x in alphabetical ordering)).


This was a simple implementation problem. I was told to write the code properly with class.

Finally, total of 9 people were selected. Out of which 6 were from Army Institute of Technology Pune. I was fortunate enough to be one of them.

Write your Interview Experience or mail it to

My Personal Notes arrow_drop_up

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

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :


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