Amazon Interview | Set 35
On-campus, 1 MCQ round, 2 coding rounds, 4 face-to-face rounds.
MCQ round(45 min)
– 5 questions on mathematics, one was from probability, all easy 15 questions technical, from each-demand paging, dining-philosopher, humming codes, 3-4 C programs output, etc
1st Coding round–2 questions(45 min)
1. Given an array,find minimum distance between two given integers in the arrays. Note that the two given integers may be same.
2. Given three linked lists, each representing an integer, add them
explanation- 3708 + 21 + 542 = 4271
2nd coding round(45 min)
1. Given an array containing both positive and negative elements, arrange in such a manner — 1 positive number, then 1 negative,then 1 positive and so on. If number of negative numbers are more,extra numbers should be kept in end and vice versa. Note the order of negative and positive elements should be same in the modified array and you are not allowed to use any extra space
2. Given a binary tree, replace each node value by sum of its children value.
Face to Face rounds–
1. Level order traversal and then level order traversal in spiral form. Only algo, no code
2. Given a dl representing the spiral level order traversal of a binary tree,convert it to a binary tree inplace. In Last level, nodes will be either to the right or left only. complete code in C
eg 1-2-3-4-5-6-7-8 o/p-- 1 / \ 3 2 / \ / \ 4 5 6 7 \ 8
3. Glass pyramid problem.Measure amount of water in j’th glass of i’th row.(algo+code)
very few technical questions
1. Given an array which is first increasing and then decreasing,how will you search an element?(only algo)
2. Convert a n-byte integer from little endian to big endian.(code was required)
3. Find k max elements from a large file.(only algos)
no technical questions at all
After some personal questions, the interviewer asked some technical questions as well
1. Suppose we receive requests for a page, but we want to ensure that max no of request per sec is ‘x’. If there are more than x requests,what will you do?
We want a continuous flow. How will you do that?
2. Suppose in a system, some processes are already running. Now when an user will give new task(or process), he will give a list of processes his process is dependent upon. Some of those may be running, some may not be running right now. You have to ensure that there is no contention, i.e., If a process, Pj is dependent on process Pi,
Pj should not execute along with Pi. How will you ensure that? Complete algorithm with code was required. The interviewer went on complicating the problem.
At last I used graph and 3 hashmaps to solve the problem. He was ok with it.
That’s it. My last round completed and I was selected.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help.
Please Login to comment...