Skip to content

Instantly share code, notes, and snippets.

@alexgolec
Created October 7, 2018 03:51
Show Gist options
  • Save alexgolec/ff9a11f6e6ea440a2f56a0e02e6b2026 to your computer and use it in GitHub Desktop.
Save alexgolec/ff9a11f6e6ea440a2f56a0e02e6b2026 to your computer and use it in GitHub Desktop.
from neighbors import neighbors
def count_sequences(start_position, num_hops):
if num_hops == 0:
return 1
num_sequences = 0
for position in neighbors(start_position):
num_sequences += count_sequences(position, num_hops - 1)
return num_sequences
if __name__ == '__main__':
print(count_sequences(6, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment