Skip to content

Instantly share code, notes, and snippets.

Embed
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):
# write your code in Python 2.7
N = len(A)
C = [0] * N
res = 0
for i in A:
if i > 0 and i <= N:
C[i-1] += 1
for i in range(1, N+1):
if not C[i-1]:
res = i
break
if not res: res = N + 1
return res
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.