LeetCode 198 House Robber - Why Naive Fails

The trap

Try all subsets of houses where no two are adjacent. Find the maximum sum.

With nn houses, there are roughly O(2n)O(2^n) subsets to check (actually Fibonacci-many valid subsets, but still exponential).

Can you decide house-by-house whether to rob or skip?