Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# you can write to stdout for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
N = len(A)
if not N: return 0
count = N
result = 1
A_ = [0] * N
for i in A:
if i > N:
result = 0
elif i <= N and not A_[i-1]:
A_[i-1] = 1
count -= 1
if count:
result = 0
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.