Write a python function to find a missing number in a list of consecutive natural numbers


Topic: Write a python function to find a missing number in a list of consecutive natural numbers

Solution

def getMissingNo(A): 
    n = len(A) 
    total = (n + 1)*(n + 2)/2
    sum_of_A = sum(A) 
    return total - sum_of_A 



List all Python Programs