Merge pull request #376 from yang170/patch-4

Update 0198.打家劫舍.md
This commit is contained in:
程序员Carl
2021-06-11 15:35:03 +08:00
committed by GitHub

View File

@ -118,7 +118,7 @@ class Solution {
if (nums == null || nums.length == 0) return 0;
if (nums.length == 1) return nums[0];
int[] dp = new int[nums.length + 1];
int[] dp = new int[nums.length];
dp[0] = nums[0];
dp[1] = Math.max(dp[0], nums[1]);
for (int i = 2; i < nums.length; i++) {