Friday 21 December 2012

Amazon Experience

It has been one month now since I was Interviewed for the SDE(Software Developer Engineer) Position in Amazon Hyderabad. The interview just like other interviews was a life time experience.


Online Coding Round (25 OCT 2012)
3 Questions, Time 1 Hour
1. Find Lowest Common Ancestor in a BST.
2. Remove duplicate nodes in a linked list.
3. A single array is given, in which half of the array is sorted and another half is also sorted, you
need to sort the entire array without using additional memory.

Telephonic: (29th Oct 2012)
1. Two arrays are given both sorted and a number k is given, you need to find two numbers from
each array such that the sum is equal to the given number.
2. Given two BST you need  to find whether two BST are same or not.
Note: here same means whether two BST are formed from the same set of numbers ie. the
structure of the two BST may differ depending upon the order in which the numbers appear. But the
two BST will only be equal if they are formed from the same set of numbers irrespective of the
structure of the BSTs.

Onsite Hyderabad: (22 Nov 2012)
First round:
1. Find the size of the largest BST present in a Binary tree.
2. Find the maximum sum path present in a Binary Tree.

Second Round(Bar Raiser, the interviewer was Awesome):
1. Given an array of integers, now suppose we form a binary search tree from that array, now
given an integer K present in that array, you need to find the encoding required to reach
that number from the root of the binary search tree so formed. The encoding is defined as :
Starting from the root of the array if you go left you append 0 to the encoding string and if
you go right you append 1 to the encoding string. You need to return the encoding string so
formed once you reach the required number  ‘K’. The constraint is that you cannot use any
additional memory nor cant you modify the original array. And you can make only one pass
of the array.
2. Given an array of integers, and a number ‘k’ , you need to find the number of unique pairs
present in the array that sum upto ‘K’ in O(n) and in one pass of the array.


Third Round(Hiring Manager):
He didn’t ask me to code in any question
1. Find the length of the longest path from one node to another node in a Binary tree.
2. Given a tree in which every node may contain any number of childs. The tree represent the
organizing hierarchy in an enterprise. Now given a node, how will you find the income of
every node present below that particular node. He asked me the data structure to organize
the node and also asked me optimize the space in case a fixed number of children for every
node is not given in advance.
3. Puzzle: given a large cube formed out of the small cubes say N*N, now you need to find only
the number of cubes present on the surface of the Large cube.
4. Scalability problem: You are given a 1000 commodity servers, each of which has 256MB of
RAM and 4GB hard disk. Now each hard disk has 1 Billion numbers. Now you need to find
the median of the the numbers present on the commodity servers.

Last Round:
1. Given a number of square shaped plates of length and breadth, now you need to find the
maximum number of plates which can be placed on the top of each other. A plate P1 can
only be placed in top of another plate P2 only if L1 < L2 and B1 < B2 where L and B represent
the length and breadth of the plate.
2. Then he just asked me informally if I have knowledge of oops concept in any Language, I said
yes in C++ and then he asked me to explain the virtual functions and their implementation in
C++.


Note: In every interview question they asked two questions at the beginning, though the questions are
not technical but they help interviewers to judge your character.
1. Tell me About Yourself.
2. Why do you want to leave your current company.
You must have strong reason for second question and for the first question you must present your skills
in well organized manner. In both of these questions they cross question you on real life example. Apart
from these, some interviewers might also ask you “Why you want to join Amazon.”


No comments:

Post a Comment