Amazon Interview Experience | Set 179 (For SDE-1)
1) Given an array which has elements in increasing order first , and then decreasing, suggest an algorithm for searching an element in it.
2) Check whether a given tree is a BST or not.
3) do not remember
1) Number of hops required to reach the end of an array , where the maximum hop is the value at index.
Tweaked question after this, to reach any node.
2) print the path between any two given nodes in a binary tree
1) Project and resume discussion.
Problems faced and how you approached them.
2) A large number of emails coming into the system, at any given time find the top k issues being faced by the users. Problem reduced to find the top k trending words in a large file.
3) Implement a vector in c, using any available data structure
1) Given a pre-order traversal of a binary tree represented by , I for internal node and L for leaf, build the tree.
2) Find the next smallest element for all the elements in a given array.
Started off with a lengthy discussion on current project, was asked to draw a schematic of the same, and then was asked to discuss my roles and responsibilities as well as suggest what improvements could be made to it.
1) Given a 2-D array, in which all the elements are either 0’s or 1’s, and all the rows are sorted, Give an algorithm for finding the row having the maximum number of 1’s. Was asked to code and analyse time complexity as well.
2) There is a given set of colours , say [1-N]. Now , people are coming into a stadium wearing t-shirts of any of these colors. Write an algorithm to find the first person to come in, to have worn an unique color.
The question wasn’t clear to me at first, so after a few examples , got what he was trying to ask.
For eg. Suppose we have colors R G B
and the stream of people are as,
G R B G G G G
the output should be R.
Hope this helps some people.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Login to comment...