Created
January 9, 2017 23:46
-
-
Save gbazilio/46be0790a014ca8cbc87a9e69a8a6b9e to your computer and use it in GitHub Desktop.
Codility - Permutation
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
def solution(A): | |
n = len(A) | |
A_sum = sum(set(A)) | |
ideal_sum = n*(n+1)/2 | |
return 1 if A_sum == ideal_sum else 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment