Skip to content

Instantly share code, notes, and snippets.

@mastern2k3
Last active January 30, 2018 17:13
Show Gist options
  • Save mastern2k3/5870ca15eef8a097d11458027a7e4ea6 to your computer and use it in GitHub Desktop.
Save mastern2k3/5870ca15eef8a097d11458027a7e4ea6 to your computer and use it in GitHub Desktop.
def p_configs(alen):
if alen == 0:
return 1
totals = 0
if alen >= 1:
totals += p_configs(alen - 1)
if alen >= 2:
totals += p_configs(alen - 2)
if alen >= 3:
totals += p_configs(alen - 3)
return totals
print(p_configs(3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment