Friday, May 27, 2016

Missing Number

giving N numbers in 0 .. N, find the one that is missing.

somebody is using binary search to find it.

it is actually can be n(n+1) -(sum of numbers). if they are equal, then 0 is missing, otherwise, the missing number is the value from formula.

No comments: