Related Articles

# Amazon Interview | Set 12

• Difficulty Level : Expert
• Last Updated : 13 Jun, 2019

I am very thankful to geeksforgeeks team for such a great site. I got offer from Amazon.

Written Test
It was online test on interviewstreet.
20 MCQs- basics of C & C++, OS and some aptitude question

There were 4 technical rounds each for 40-60 minutes, no HR round.
1st Round
Given two numbers and a binary tree, all elements in binary tree are distinct, write code to determine the shortest distance between the two nodes. (unit distance between two adjacent nodes). Nodes don’t have parent pointer.

2nd Round
1. Level order traversal in spiral form

2. There are some glasses with equal volume 1 litre. The glasses kept as follows

1
2   3
4    5    6
7    8    9   10

You can put water to only top glass. If you put more than 1 litre water to 1st glass, water overflow and fill equally both 2nd and 3rd glass. Glass 5 will get water from both 2nd glass and 3rd glass and so on..
If you have X litre of water and you put that water in top glass, so tell me how much water contained by jth glass in ith row.
Example. If you will put 2 litre on top.
1st – 1 litre
2nd – 1/2 litre
3rd –  1/2 litre

3rd Round
1. Check for BST

2. Liked list is given as below (with elements as 1, 2 and 3), sort this in one pass.
3->2->2->1->2->3->1

4th Round
1. An expression is given.
[] can enclosed [], {} and ()
{} can enclosed {}, ()
() can enclosed only ()
Check that brackets in the expression are valid or not according to enclosing condition and opening closing condition.