打家劫舍

LeetCode 经典 150 一维动态规划
难度: 中等

题目描述

计算可以偷窃的最大金额,不能偷相邻的房屋。

解题思路

使用动态规划,递推公式为 dp[i] = max(dp[i-1], dp[i-2] + nums[i])。