nums
has only one element, return that element as the result.rob_linear
that takes a subarray of nums
and returns the maximum amount of money that can be robbed from that subarray using dynamic programming.rob_linear
on nums[1:]
to solve the subproblem excluding the first house.rob_linear
on nums[:-1]
to solve the subproblem excluding the last house.