Intel Corporation Interview Question

Given an array of 99 unique numbers from 1-100, how do you determine the missing element?

Interview Answers

Anonymous

Feb 3, 2012

There is a straight up mathematical solution in O(n) time, and a O(nlogn) algorithm involving a sort.

Anonymous

Mar 3, 2013

sum all numbers. sum of 1- 100 is 5050 so subtract that summation from 5050.