Try all subsets of houses where no two are adjacent. Find the maximum sum.
With houses, there are roughly subsets to check (actually Fibonacci-many valid subsets, but still exponential).
Can you decide house-by-house whether to rob or skip?
The trap
Try all subsets of houses where no two are adjacent. Find the maximum sum.
With houses, there are roughly subsets to check (actually Fibonacci-many valid subsets, but still exponential).
Can you decide house-by-house whether to rob or skip?