Amazon Interview Questions
- 0of 0 votes
AnswersImplement an iterator for a Binary tree. It should have the following things:
- JSDUDE May 04, 2013 in United States
1. bool HasNext()
2. <T> Next()
It should be an in-order traversal.| Report Duplicate | Flag | PURGE
Amazon SDE1 Trees and Graphs - 0of 0 votes
AnswersAdding Very Large Numbers. Write clean code for it. please check all corner cases..
- nr May 02, 2013 in United States for web service
Number can be really really large| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersFind the 3rd closest element in a bst.You will be given a pointer to root and a value within the tree against which the closest has to be figured out. (closeness is in terms of value, not by distance ) and then follow up qn: for finding the kth closest in a bst.
- seth May 02, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 0of 0 votes
AnswersInput is given a binarytree and out is sum of the all the children data and its node data .
- phaniteja.24 April 27, 2013 in India
Eg:
1 28
2 3 11 16
4 5 6 7 4 5 6 7| Report Duplicate | Flag | PURGE
Amazon SDE1 - -1of 1 vote
AnswersGiven a sorted array consisting 0's and 1's. find the index of first '1'. write a complete program which takes less time complexity. and test all boundary conditions also.
- phaniteja.24 April 27, 2013 in India
Eg: If given array is 0,0,0,0,0,0,1,1,1,1 the out put should be 6.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 3 votes
AnswersCode to create a file system.... Have classes like directory, file and all
- nr April 21, 2013 in United States for Kindle
please write the full code| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 2of 2 votes
AnswersIn a BST, I want to replace all nodes with value which is the sum of all the nodes which are greater than equal to the current node.
- Abhishek Shrivastava April 20, 2013 in United States
5
2 10
Output -->
15
17 10| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersYou are given a BST, and min, max elements. Your task is to trim this BST so that it contains the elements between the min and the max elements.
For example, given the mix and max elements [5, 13] and the tree below, you would return the output below.8 3 10 1 6 14 4 7 13
output should be :--->
- Abhishek Shrivastava April 20, 2013 in United States8 6 10 7 13
| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersFinding border of a binary tree.Given a Binary tree print all the nodes that form the boundary.
- mrunalishah.cool April 20, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 0of 0 votes
Answershow do you handle your thread, to avoid dead lock and efficient(generally question)
- xuwanglong1988 April 19, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
Answerswhat is Materialized view, is any different from View.
- xuwanglong1988 April 19, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Database - 0of 0 votes
AnswersData Structure for node of linked list
- kumar.prince6 April 11, 2013 in India for IDC
Find the nth node form end of a linked list and also write test case
i have given solution with o(n) after that they asked to me how to break the my algorithm| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersDesign an algorithm to remove the duplicate characters in a string without using any additional buffer. NOTE: One or two additional variables are fine. An extra copy of the array is not. also do with o(n2),o(n),o(1) ,write test case and breake the algorithm whatever you write.
- kumar.prince6 April 11, 2013 in India for IDC| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersN boys are sitting in a circle. Each of them have some apples in their hand.
- pavi.8081 April 09, 2013 in United States
You find that the total number of the apples can be divided by N.
So you want to divide the apples equally among all the boys.
But they are so lazy that each one of them only wants to give one apple to one of the neighbors at one step.
Calculate the minimal number of steps to make each boy have the same number of apples.
Input Given:
1. A number N => number of children.
2. Sequence of N numbers, each representing number of apples a child has.
<<P.S.>>
Passing an apple means a child giving away one apple to one of its neighbour.
Even if 2 separate children can pass apples simultaneously or one child can pass 1-1 apple to each of its neighbours then that will still be counted as 2 steps and not 1 step.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 2of 2 votes
Answersint board[8][8] each value in the matrix represents a character. 1-9 number represents all whites and 11-19 represents all blacks.
- ANONU March 27, 2013 in United States
Given a pawn at (x,y) print all possible moves. Assume whites are index 0 and blacks are at index 7.| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 4 votes
AnswersThe cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days
- ANONU March 27, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 2 votes
AnswersFind top k searched elements from a continuous stream of data.
- firefox March 25, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - -2of 2 votes
AnswersGiven 2 arrays with numbers, multiply the numbers with corresponding indexes and return the sum of all the products.
- Nitin Gupta March 20, 2013 in India for WebStore
Twist :- When one array gets consumed then start with its first element again.
A : 1,2,3,4,5
B : 2,1
Output: 24 (1*2 + 2*1 + 3*2 + 4*1 + 5*2)| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - -1of 3 votes
AnswersPrint N numbers of form 2^i.5^j in increasing order for all i >= 0 , j >= 0 ?
- Nitin Gupta March 20, 2013 in India for WebStore
Example : - 1,2,4,5,8,10,16,20.....| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 2 votes
AnswersFind kth Largest element in BST
- Razz March 06, 2013 in India| Report Duplicate | Flag | PURGE
Amazon SDE1