Skip to content

Instantly share code, notes, and snippets.

@gbazilio
Created January 12, 2017 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbazilio/20ad704e43bc30aa14b0fda55f3e5563 to your computer and use it in GitHub Desktop.
Save gbazilio/20ad704e43bc30aa14b0fda55f3e5563 to your computer and use it in GitHub Desktop.
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