House Robber
Medium
Topics
You are a robber planning to rob houses along a street. You cannot rob two adjacent houses. Given nums (money in each house), return the maximum you can rob without alerting the police.
Example 1
Input: nums = [1,2,3,1] Output: 4
Example 2
Input: nums = [2,7,9,3,1] Output: 12
Constraints
- 1 <= nums.length <= 100
- 0 <= nums[i] <= 400
Run ⌘' · Submit ⌘⏎