Find the Missing Number | a represents the array n : Number of elements in array a ; Driver Code
def getMissingNo ( a , n ) : NEW_LINE INDENT i , total = 0 , 1 NEW_LINE for i in range ( 2 , n + 2 ) : NEW_LINE INDENT total += i NEW_LINE total -= a [ i - 2 ] NEW_LINE DEDENT return total NEW_LINE DEDENT arr = [ 1 , 2 , 3 , 5 ] NEW_LINE print ( getMissingNo ( arr , len ( arr ) ) ) NEW_LINE