Amazon Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Written Test




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

this is a Dynamic programming question..similar to maximum sum from coins in a line question..

- Anonymous March 25, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

what is the condition for winning? Also can they remove just the last pointer on the list's either sides?

- Sandy March 25, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

After each user plays the game- removal of a number from the list, the sum is collected for each user, as he proceeds in the game. After all the turns, the sum for each user is noted, and whichever is higher wins the game!

- jimmy514in March 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

can they remove just the last pointer value on the list's either sides?

- Sandy March 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Its a double ended queue, so they can remove from either ends of the queue.

- jimmy514in March 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

my question is can they pick any number or they have to pick sequentially and is the array sorted in any way?

- Sandy March 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

The array is not sorted, they can remove the number from either ends of the dequeue. But this is done in an alternative fashion , starting with the first user.
If there are two users A, B . First A picks any number either from front;/ rear . And then B picks. And then A.. till the queue becomes empty!

- jimmy514in March 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

What does the "...maximize the chance of each player winning..." mean? I am avoiding thinking along the min/max algo. direction.
Is it that the end sums of both the players needs be or will eventually be closer to each other as much as possible? And then the one who happens to have a larger sum wins?

- nik March 26, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

This question sounds confusing to me. Can you please elaborate with a simple example.

- DashDash March 26, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

so if I have understood this right, after each player makes the decision, the sum of the digits/numbes left behind in the deque is added to their total ?

> since you can either pop an element from the head or tail, the decision can just be based on comparing head->peek() and tail->peek() (whichever is smaller).

If on the other hand, after each player decides the number formed out of the digits/numbers in the deque are added to their total, the decision is mainly based on what the next element to head is.
For example: if the deque is,
head-> 6 2 5 4 3 1 7 8 <-tail

if head->next->peek() < head->value() { pop (tail) }
else if head->next->peek() == head->value() {
if tail->prev->peek() > tail->value {
pop (tail)
} else { pop (head) }
else { pop(head) }

(am assuming that the deque has a suitable API to support the operations mentioned above. idea is to discuss what an ideal strategy should be)

- VJ March 27, 2013 | 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