Skip to content

Instantly share code, notes, and snippets.

@nma
Last active January 6, 2021 04:35
Show Gist options
  • Save nma/8ad4af763c2281105c7979bbe522cae7 to your computer and use it in GitHub Desktop.
Save nma/8ad4af763c2281105c7979bbe522cae7 to your computer and use it in GitHub Desktop.
def rob_houses(house: Tuple[int]) -> int:
if len(house) == 0: return 0
if len(house) == 1: return house[0]
criminal_gains = max(
rob_houses(house[1:]),
house[1] + rob_houses(house[2:])
)
return criminal_gains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment