Problems

24. House Robber

MediumDynamic ProgrammingAmazonGoogle

Return the maximum amount that can be robbed without choosing two adjacent houses.

Example 1:

Input: nums = [1,2,3,1]
Output: 4

Example 2:

Input: nums = [2,7,9,3,1]
Output: 12

Constraints:

  • 0 <= nums.length <= 100
Core code mode
● Auto-savedLine 1, column 1