I have been working with Amazon for last 2 years and 4 months. Here, is my interview experience when I was the interviewee:
Off Campus Drive (DCE) – 2012
1-> WAP to merge two linked lists like:
list1: 1->2->3->4 list2: 5->6->7 o/p list: 1->5->2->6->3->7->4
2-> Given two trees T1 and T2. WAP to check whether T1 is a subtree of T2 or T2 is a subtree of T1
3-> WAP to find maximum sum sub-matrix from a give matrix.
1->You are given a sorted but rotated array of integer like: 6 7 8 1 2 3 4 5
You have to search an element…
I answered with an O(logn) solution…
then he asked me to write the code…
2->What is the diameter of a tree?
then he asked me to write the complete code…
3->He asked me a design problem “you have to design a class “DeckofCards”…with 2 operations: 1:Shuffle 2:Pick”
Pick would pick a random card from the deck and Shuffle will shuffle the cards and give you back the deck of cards.
I answered with 2 options 1.LinkedList 2:Array…then there was a discussion around 15 mins over both the solutions…
Round 2:(I guess it was the bar-raiser round)
1-> My Introduction and My Projects (all 1 by 1 except the last)
2-> How to compute all possible solution of A^3+B^3=C^3, where A,B,C belongs to (0 to N)?
3-> How to compute A^n where n<1 million Write code... 4-> A tough “matrix with a mask” problem…I took around 20 mins to solve it.
5-> Why Amazon, what is scalability and questions from my answers…like how would you manage millions of requests…
1-> You r given a matrix of 0s and 1s. WAP that check if an element is 0 or not and places zeros to all the col and row of that element.
eg: i/p: 1 1 1 1 o/p : 1 1 0 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1
2-> How to find a largest palindrome from a given string? Write code….
3-> How many Data Structures you have implemented by yourself?
4-> Given some words(written in lexical order) of some unknown language…You have to find lexical ordering of all the alphabets…
Like in english lexical ordering is A B C…Z
Forth round was just related to my projects and subjects…(Paging, Deadlock, Trashing, JAVA and C, Synchronization, etc) + 1 final algo question “How to find all anagrams in a dictionary” Solution was in O(1)..
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 other Geeks.