You are a robber planning to rob houses along a street. Each house has a non-negative amount of money. You cannot rob two adjacent houses; the alarm will trigger. Given an integer array nums where nums[i] is the amount at house i, return the maximum amount you can rob.
Input: nums = [1, 2, 3, 1] Output: 4 Explanation: Rob house 0 (value 1) and house 2 (value 3) for a total of 4.
Input: nums = [2, 7, 9, 3, 1] Output: 12 Explanation: Rob house 0 (2), house 2 (9), and house 4 (1) for a total of 12.
nums = [1, 2, 3, 1]