House Robber
Transitions
Top-down
def house_robber(houses):
def rob(i):
if i >= len(houses):
return 0
return max(rob(i + 1), rob(i + 2) + houses[i])
return rob(0)Deriving bottom-up
Bottom-up
Last updated