## Amazon interview experience (Software development engineer - I )

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

Congratulations! Thank you for sharing your experience.

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

Congratulations Shri!!!

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

Congratulations Shri!!!

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

Regarding the first question,

What do you mean by swapping?
Is swapping the values sufficient? or Manipulating the links was necessary?

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

Can any one explain solution of the gold box problem?

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

Apply dynamic programming. The game state can be described by the left and right endpoints. States are only valid where left <= right. For each possible state, find out how many points player A gets and B gets (when you change turn, you need the B value).
There are O(N^2) states with O(1) processing for each one (either pick left or right boxes), therefore the solution has a time complexity of O(N^2).

Comment hidden because of low score. Click to expand.
0
of 0 vote
{{{ {Algorithm} p1=p2=root; //Initially both pointers pointing to the same location int temp; while(p2=p2->next) { temp=p2->data; p2->data=p1->data; p1->data=temp; if(p2=p2->next) { p1=p2; } else return; }
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi,

First of all, congratulations!

About the question "2) Given a function isGreater, compare user defined objects and then return the object that is greater than all other objects.", can you do better than O(N^2)? Since there is no transitivity, I think we can't do something like sorting..

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

``````{Algorithm}
struct Node
{
int data;
struct Node *next;
};
struct Node *root;

p1=p2=root; //Initially both pointers pointing to the same location
int temp;
while(p2=p2->next)
{
temp=p2->data;
p2->data=p1->data;
p1->data=temp;
if(p2=p2->next)
{
p1=p2;
}
else
return;
}``````

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.

### 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.