Tuesday, August 23, 2011

Amazon Telephonic Interviews

In my first Telephonic Interviews, following 2 questions were asked
1. You are given a huge array, which contains integer with repetition
you have to find first non-repetitive number in the array.
e.g
array is a,b,a,c,b
result is c
array is a,b,d,a,b,c
result is d


2. You are given a binary search tree in which one node is corrupted. You have to find that node.

In my 2nd Telephonic Interview, following 2 questions were asked
1. You are given a huge array of integers, in which elements are in sorted and ascending order. You have to search
an element index in the array.
Assumptions: length of array is not given. Morever you can't find the length of array using sizeof() operator.

2. you are given a binary tree. you need to write a method function which takes root of node as input and return an
array of length h, where h is the height of tree such that each array element contains head of linklist of nodes of
each level of tree
In other words, you need to create linklist of each level of Binary tree and have to store it's head pointer of each
level to array at that index and return that array.

No comments:

Post a Comment