Created
August 28, 2015 21:40
-
-
Save 43061b4a/3566eb03cfdff34bb910 to your computer and use it in GitHub Desktop.
This file contains 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
# you can use print for debugging purposes, e.g. | |
# print "this is a debug message" | |
def solution(A): | |
m = len(A) + 1 | |
expected_sum = (m * (m+1)) / 2 | |
return expected_sum - sum(A) | |
# https://codility.com/demo/results/demo4C4YQX-MX2/ | |
# O(N) or O(N * log(N)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment