You are given an array of integers where each element represents the amount of money stored in a house.
You want to maximize the total money you can collect without taking money from two adjacent houses, as that would trigger the security alarm.
Your task is to calculate the maximum total amount that can be collected following this rule.
Input: nums = [5, 1, 2, 10, 6]
Output: 15
Input: nums = [3, 8, 4, 9, 10, 2]
Output: 19
Accepted:
Submission: