Amazon interview – Set 1

Round 1(Telephonic)
1. Given a binary tree and an integer x, return whether the binary tree has a path from root to a leaf whose values sum to x.
2. Gievn a binary tree and return all root to leaf node pathss row,col and value.
3. He then asked me to give test cases for testing this program.

Round 2(F2F)
1. Given two unsorted arrays of numbers and asked me to find the intersection.
2. getMax() function for a stack in O(1).
3. getMax() function for a queue in O(1).

Round 3 (F2F)
1. Given an array in which consecutive elements differ by 1, i.e. a[i] – a[i + 1] = 1 or -1, and an element x, find the element in the array.
2. Given an array, find the Next Greatest Element to the right for each element.
3. Given an expression, remove unnecessary parenthesis. For example if (((a + b)) * c) is given make it (a + b) * c, as it evaluates in the same way without those parenthesis also.

Round 4 (F2F)
1. Given an array of integers, find the maximum product which can be formed by three numbers
2. Given an array of integers, find the length of the longest consecutive sub array which forms an AP.
3. Given a binary tree, connect all the nodes at the same level. Each node will have a next pointer; you have to make it point to the next node to its right in the same level. If there is no such node, make it point to null.

Thanks Satveer for sharing your interview experience. You can also share your interview experience to [email protected] We will be glad to publish it to our website and help others.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation