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(X, A):
# write your code in Python 2.7
L = len(A)
P = [-1]*X
min = 0
for i in range(0, L):
p = A[i] - 1
if p < X and P[p] == -1:
min = i
P[p] = i
for e in P:
if e == -1:
min = e
break
return min
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.