nums[i] is the money in house i. Adjacent houses share an alarm, so you cannot rob two in a row.
nums[i]
i
Return the maximum amount you can rob.
nums = [1,2,3,1]
4
Why
Rob house 0 and house 2.
nums = [2,7,9,3,1]
12
1 <= nums.length <= 100 0 <= nums[i] <= 400
Topics
Implement rob in the editor and return the answer — printing it is never graded.
rob
Problem 89 of 1146 in the arena