Created
March 27, 2018 18:52
-
-
Save gootik/c208511a8298413c0c8941723b77ef18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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