Skip to content

Commit

Permalink
整数拆分.md Javascript
Browse files Browse the repository at this point in the history
fusunx committed Jul 1, 2021
1 parent e339f19 commit 759f053
Showing 2 changed files with 14 additions and 17 deletions.
16 changes: 0 additions & 16 deletions .vscode/launch.json

This file was deleted.

15 changes: 14 additions & 1 deletion problems/0343.整数拆分.md
Original file line number Diff line number Diff line change
@@ -225,7 +225,20 @@ class Solution:
Go:



Javascript:
```Javascript
var integerBreak = function(n) {
let dp = new Array(n + 1).fill(0)
dp[2] = 1

for(let i = 3; i <= n; i++) {
for(let j = 1; j < i; j++) {
dp[i] = Math.max(dp[i], dp[i - j] * j, (i - j) * j)
}
}
return dp[n]
};
```

-----------------------
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)

0 comments on commit 759f053

Please sign in to comment.