Skip to content

Instantly share code, notes, and snippets.

@gootik
Created March 27, 2018 18:52
Show Gist options
  • Save gootik/c208511a8298413c0c8941723b77ef18 to your computer and use it in GitHub Desktop.
Save gootik/c208511a8298413c0c8941723b77ef18 to your computer and use it in GitHub Desktop.
# getMissingNo takes list as argument
def getMissingNo(A):
n = len(A)
total = (n+1)*(n+2)/2
sum_of_A = sum(A)
return total - sum_of_A
# Driver program to test above function
A = [1, 2, 4, 5, 6]
miss = getMissingNo(A)
print(miss)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment