Missing One Number In Array

Missing One Number In Array

An array contains all the integer from 0 to n, expect for one number which is missing. Find missing number in O(n) in O(1) extra space.


  • Sum of firs n natural number [i.e. Sum (1+2+3+………+n)] = n(n+1)/2
  1. Find sum of array’s of elements
  2. Find sum of n natural number
  3. Return sum_of_natural_number – sum_of_array’s_element

Latest Source Code:
Github: MissingOneNumberInArray.java


Array: [2, 1, 5, 3]
N: 5
Missing Number: 4
Author: Hrishikesh Mishra