loading…
money[i] is cash in house i along a street. You can't rob two adjacent houses. Write rob(money) returning the most you can take.
rob([2, 7, 9, 3, 1]) -> 12 # 2 + 9 + 1
Stuck on the idea itself? The recursion & dp lesson walks through the pattern from scratch.