You are a robber planning to rob houses along a street. Each house has some money, but adjacent houses have connected alarms, so robbing two adjacent houses triggers the police.
Given an integer array nums of the money in each house, return the maximum amount you can rob without alerting the police.
Example
nums = [1, 2, 3, 1] => 4 // rob house 0 and 2
nums = [2, 7, 9, 3, 1] => 12 // rob houses 0, 2, 4
function Rob(nums: int[]) -> int
Found a bug? Or annoyed about something in the language? Tell us.