← All problems
House Robber
A robber wants to rob houses arranged in a line; robbing two adjacent houses triggers an alarm. Given each house's loot value, compute the maximum loot possible without triggering the alarm.
Complexity
Time O(n), Space O(1)
Common pitfalls
- Greedy by value (fails)
- Forgetting the circular variant constraint
Your solution
Log in to save your code and track progress.