Skip to content

Instantly share code, notes, and snippets.

@ta1hia
Created March 11, 2016 05:51
Show Gist options
  • Save ta1hia/6b9ab12e0c577f77c94a to your computer and use it in GitHub Desktop.
Save ta1hia/6b9ab12e0c577f77c94a to your computer and use it in GitHub Desktop.
# 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