News for hackers. Stuff that matters.
Re:Amazon’s Interview Questions And Why I Don’t Work At Amazon by oh_sigh on Sunday October 20, 2013 @08:58PM (#6582434)
Add all the numbers in the list up, and then subtract that value from the sum of 1 to 250. That value is the missing number, in O(n) time and O(1) space. This only works if all the numbers are only written once though.
Re:Amazon’s Interview Questions And Why I Don’t Work At Amazon by yelnatz on Sunday October 20, 2013 @09:12PM (#6582524)
Can't just do that right away since you have to parse the string first:

...11123...

Is that a 1, an 11, a 12, a 112, a 123?

Re:Amazon’s Interview Questions And Why I Don’t Work At Amazon by jffry on Sunday October 20, 2013 @09:32PM (#6582610)
Sum all the individual digits of 1-250 (e.g. 11 is 1+1 is 2). Sum all the individual digits in your string. Now you at least know the sum of the missing digits, and how many missing digits there are.