Last active
January 6, 2021 04:35
-
-
Save nma/8ad4af763c2281105c7979bbe522cae7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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