Created
March 11, 2016 05:51
-
-
Save ta1hia/6b9ab12e0c577f77c94a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# 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