Algorithm · ByteDance · Medium
Problem You are given an array nums with n entries, where nums[i] is the cash stored in house i. On a single night, you must not rob neighboring houses, so selecting house i excludes selecting house i+1. Determine the greatest total amount that can be taken without setting off the alarm. Parameters nums (list[int]): A list of non-negative integers representing the amount of money in each house. Return Value int: The maximum amount that can be robbed without robbing two…
Checking your access…