Find the Missing Number – GeeksforGeeks

Method 1: This method uses the technique of the summation formula.. Approach: The length of the array is n-1. So the sum of all n elements, i.e sum of numbers from 1 to n can be calculated using the formula n*(n+1)/2.Now find the sum of all the elements in the array and subtract it from the sum of first n natural numbers, it will be the value of the missing element.

https://www.geeksforgeeks.org/find-the-missing-number/