Find the missing number
You are given an array of size n-1. The array contains numbers 1-n. All numbers in the array are unique. Find the missing number
The solution .. add up all the numbers in the given array. The missing number is the difference between the n(n+1)/2 and the sum.
No comments:
Post a Comment