Back to exercises

House Robber

Track the best result when including or excluding the current house. A rolling two-variable DP solution keeps the implementation compact.

Coding Exercises Medium O(n)

House Robber

Track the best result when including or excluding the current house. A rolling two-variable DP solution keeps the implementation compact.

Return the maximum amount you can rob from houses without robbing adjacent houses.