← All problems

House Robber

Medium dynamic programming LeetCode ↗
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.

Hints (0/3 revealed)

Log in to reveal hints progressively.

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.