Problem
A robber plans to take money from a row of houses. The integer array nums gives the amount of money in each house, in order.
The robber cannot take money from two adjacent houses. Adjacent houses are houses that are next to each other in the row.
Return the maximum total amount of money that the robber can take.
Example 1
- Input:
- nums = [3,8,4,1,6]
- Output:
- 14
- Explanation:
- Take money from the houses at indexes 1 and 4. The total is
8 + 6, which is 14.
Example 2
- Input:
- nums = [5,1,1,5]
- Output:
- 10
- Explanation:
- Take money from the first house and the last house. These two houses are not adjacent.
Constraints
- 1 <= nums.length <= 100
- 0 <= nums[i] <= 400
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Beautiful Arrangement
Coding · Array · Backtracking · Bit Manipulation
- Best Time to Buy and Sell Stock
Coding · Array · Dynamic Programming
- Best Time to Buy and Sell Stock II
Coding · Array · Dynamic Programming · Greedy
- Coin Change
Coding · Array · Breadth-First Search · Complete Knapsack
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 2 records
Amazon
Leetcode 198. House Robber
Reported Dec 11, 2025 · 2 source reports
MID_LEVEL, SENIOR
Source snapshot: Nov 12, 2026
View sourceGoldman Sachs
Leetcode 198. House Robber
Reported Jan 31, 2026 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 5 records
Amazon
House Robber
Reported date not specified · Source window: 30d
Source snapshot: Oct 20, 2026
Source frequency score: 67.4. This is not an interview probability.
View sourceApple
House Robber
Reported date not specified · Source window: 3mo