Missing Numbers

  • + 12 comments

    I think a count array of size 201 is the way to go, that gives the best space/time performance. You only need to remember the value of the very first element read which is your pivot. Count of this pivot is stored at the 100th index in the count array. It is guaranteed that all other elements are within +/- 100 range hence 200 slots is the maximum you need.