Amazon Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
1
of 0 vote

1) Divide 9 marbles into group of 3, and then select any two group and check their weight. If either of is heavier, then select that group or select third group. Now select any two marbles out of this group of three and check their weight. By this procedure you need to compare just twice.

- Anonymous October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

To find two nos in array whose sum is equal to given no:
1) If array is sorted the your method can give result in O(n) else it will require O(nlgn) + O(n)
2) If memory is not the constraint then add each element of array in hasttable in O(n). In other O(n) find the two nos. Total : O(n) + O(n)

- Anonymous October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1 evaluate(ExpressionTree t){
if(t is a leaf)
return value of t's operand ;
4 else{
5 operator = t.element ;
6 operand1 = evaluate(t.left) ;
7 operand2 = evaluate(t.right) ;
8 return(applyOperator(operand1, operator, operand2) ;
9 }
}

- Anonymous October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For the marbles problem, how are you able to say it is log n. Since you are diving it into group of three each time

- Anonymous October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Two years ago, I passed two phone interviews and went to Seattle WA for the interview. I was asked about the same elevator question in my second phone interview. It is amazing that they keep asking the same questions again and again over several years.

- Mindy October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

BTW the 9 marbles question is a variation of the original question which had only 8 marbles. 9 marbles can be solved by using the scale only 2 times.

- Mindy October 18, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The marbles problem has the answer log n(to base 3) only if, its given that the odd marble is either lighter or heavier.

- knap October 21, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Mindy, so finally you answered the "elevator question" and got hired by Amazon? You rock Mindy!
So give tips to your other friends out here who are waiting to be hired by Amazon. :-)

- nickNack September 08, 2009 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More