題庫
00:00

24. House Robber

中等動態規劃AmazonGoogle

Return the maximum amount that can be robbed without choosing two adjacent houses.

範例 1:

輸入: nums = [1,2,3,1]
輸出: 4

範例 2:

輸入: nums = [2,7,9,3,1]
輸出: 12

限制條件:

  • 0 <= nums.length <= 100
核心程式碼模式
● 已自動儲存第 1 行,第 1 欄