Amazon Interview | Set 43 (On-Campus)

Questions asked in Amazon Interview.

Round 2: Written
1. Find the SQRT of a number.

2. Simulate Reversed level order traversal.



Three F2Fs.
F2F 1:
1. Given a binary tree, no two adjacent nodes have same color, but all leaves should be in same color. You can fill only with two colors. Write a function to find whether a given tree can be colored using above scenario.

2. Given a binary tree, change the right pointer of every leaf node to the next leaf node (right to it but may be on different level).

3. Given a class with n people,where each people plays a game with all other people. Results are with you. You have to arrange them in a queue with a condition that, a[i] should have won a[i-1], for all I, you don’t need to care about a[i-2] . (a[i] may win or lose a[i-2]).

F2F 2:
1. Write prime numbers from 1 to 100000.

2. Another simple question from tree. can’t remember 🙁

3. Question from probability. Given c containers, r red balls, g green balls. Give a condition that if a guy randomly pick a ball from any of the containers, it should be red.(more probable)

F2F 3:
1. Reverse a linked list iteratively, recursively.(Ice breaking question :P)

2. Given a matrix with 1s and 0s, u have to construct a matrix such that a[i][j]=1, if only every element in ith row and jth column is 1, otherwise 0. You have to use constant space and O(mn) time complexity.

3. Maze solve problem. Given a matrix with 1s and 0s, 0 represents free path, 1 represents blocked area, and you can move in any of the 8 directions. Find the path from source to destination and print it. Then he told me that he can change destination at run time. And asked me to do for that.

This article is contributed by Karthick Raja R. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.


Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.