This is a

solution to

problem 8 on the

**hard interview questions** node. If you have not read the

question, the

following will make no

sense to you:

For the first part, compute the sum of the numbers from 1 to `N-1`. Then sum the values in the array. The duplicate number is the difference between these sums.

For the second part, compute the sum of the numbers from 1 to `N+1`. Then sum the values in the array. The missing number is again the difference between these sums.