Back to the Problem
The full sum should be N(N+1)/2; subtract what is actually present.
Complexity: O(N)