Search
⌘K

Leetcode 198. House Robber

Given an array of nonnegative integers representing house values, find the maximum sum you can obtain by selecting houses with the constraint that no two chosen houses are adjacent — a classic dynamic programming problem of deciding at each index whether to rob it or skip it to maximize total.

Asked at:

Goldman Sachs

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late January, 2026

Goldman Sachs

Mid-level

2 follow ups : - Do it in O(1) space. - Return the selected houses.

Mid December, 2025

Amazon

Amazon

Senior

Early February, 2025

Amazon

Amazon

Mid-level

Your account is free and you can post anonymously if you choose.