Skip to content

Instantly share code, notes, and snippets.

@gbazilio
Created January 12, 2017 21:39
Codiligty - Frog jump leaves
def solution(X, A):
count_array = [0] * (X)
leaves = 0
for index in xrange(len(A)):
if count_array[A[index] - 1] == 0:
count_array[A[index] - 1] = 1
leaves += 1
if leaves == X:
return index
return -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment