Skip to content

Commit

Permalink
Merge pull request #773 from Jerry-306/patch-11
Browse files Browse the repository at this point in the history
更新 0053 最大子序和 JavaScript 解法
  • Loading branch information
youngyangyang04 authored Sep 24, 2021
2 parents 9fa333e + 270757a commit 7081a0f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion problems/0053.最大子序和(动态规划).md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ JavaScript:
```javascript
const maxSubArray = nums => {
// 数组长度,dp初始化
const [len, dp] = [nums.length, [nums[0]]];
const len = nums.length;
let dp = new Array(len).fill(0);
// 最大值初始化为dp[0]
let max = dp[0];
for (let i = 1; i < len; i++) {
Expand Down

0 comments on commit 7081a0f

Please sign in to comment.