Created
January 8, 2017 14:28
-
-
Save gbazilio/f66a18ad3239bb0a48e68cad407f8a26 to your computer and use it in GitHub Desktop.
Codility - Missing element
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
def solution(A): | |
A_length = len(A) | |
array_sum = sum(A) | |
complete_sequence_sum = (A_length * (A_length + 1) / 2) + (A_length + 1) | |
return complete_sequence_sum - array_sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment