Amazon.com
3.3 of 5 3,212 reviews
www.amazon.com Seattle, WA 5000+ Employees

Amazon.com Software Design Engineer Interview Question (student candidate)

I interviewed in Seattle, WA and was asked:
"Given an array of 100 integers where every integer from 1-101 occurs once, except for one. Find the missing integer."
Add Tags [?]
Answer Flag Question

Part of a Software Design Engineer Interview Review - one of 4,609 Amazon.com Interview Reviews

Answers & Comments

1
of 3
votes
sum of number from 1 to n is n(n+1)/2

So Sum from 1 to 101 = (101*102)/2 = 5151

So missing number is 5151 - (sum of all elements in the given array)
- Anonymous on Dec 3, 2010 Flag Response
0
of 0
votes
Let a = XOR of all elements in array and b = XOR of all numbers from 1 to 100. The final result is a XOR b
- Anonymous on Jun 14, 2012 Flag Response

To comment on this question, Sign In with Facebook or Sign Up


Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Amazon.com interview questions and advice. All interview reviews posted anonymously by Amazon.com employees and interview candidates.