Amazon Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




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

XOR all the numbers together you will get the odd one out. O(n)

- Bob April 10, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

BRILLIANT!

- mavrav April 11, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Brilliant Indeed !

- Ravi April 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

HIRED!

- animosity April 16, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Excellent

- Anonymous April 20, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

What if the one odd number is a zero?

- Anonymous April 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

it works even if the odd number is zero

- suvrokroy May 12, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thanks almost missed that approach ,I used hashtable . But never the less i could clear the round

- RohitDumbre86 April 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

trace the number of zeros and if it is even then sum is the answer otherwise 0 is the answer.

- Santosh April 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

int a[]={1,2,3,4,5,6,7,8,9,1,2,3,5,6,7,8,9};
int size=sizeof(a)/sizeof(int);
int sum=0,p;
for(int i=0;i<size;i++)
printf("%d ",a[i]);
for(int i=0;i<size;i++)
{
sum=sum^a[i];
}
printf("\nnun duplicated number is %d",sum);

- jai April 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yeah, I would use a hash table too. My values would be booleans which I would simply toggle. Whichever value is true after parsing the array, the key would be that number.

- James April 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

My approach was that run a loop and put in the hashtable. If number occurs again increment the value.
After this run through an enumerator and do a modulus operation.

- RohitDumbre86 April 11, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

need to check just half of the array.

garimaa.blogspot.in/2012/04/program-12th-in-c_11.html

- Solution April 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

wrong answer kido!!!
It is only applicable if the array is sorted but it is no where mentioned that it is sorted.Go for XOR operation

- BOOM April 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

wrong answer kido!!!
It is only applicable if the array is sorted but it is no where mentioned that it is sorted.Go for XOR operation

- BOOM April 15, 2012 | Flag


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