fix: 0053.动态规划 js代码修正

This commit is contained in:
李众豪
2022-03-01 08:56:51 +08:00
parent e50e84bc65
commit fc5b272bd6

View File

@ -174,6 +174,7 @@ const maxSubArray = nums => {
// 数组长度dp初始化
const len = nums.length;
let dp = new Array(len).fill(0);
dp[0] = nums[0];
// 最大值初始化为dp[0]
let max = dp[0];
for (let i = 1; i < len; i++) {