From ff135662de4d1f282ead7f76c17a35806d99259e Mon Sep 17 00:00:00 2001 From: sanwulol Date: Fri, 8 Apr 2022 17:01:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=80=900122-=E4=B9=B0?= =?UTF-8?q?=E5=8D=96=E8=82=A1=E7=A5=A8=E7=9A=84=E6=9C=80=E4=BD=B3=E6=97=B6?= =?UTF-8?q?=E6=9C=BAII.md(=E5=8A=A8=E6=80=81=E8=A7=84=E5=88=92)=E3=80=91ja?= =?UTF-8?q?vaScript=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0122.买卖股票的最佳时机II(动态规划).md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0122.买卖股票的最佳时机II(动态规划).md b/problems/0122.买卖股票的最佳时机II(动态规划).md index 615d79bb..5a165a14 100644 --- a/problems/0122.买卖股票的最佳时机II(动态规划).md +++ b/problems/0122.买卖股票的最佳时机II(动态规划).md @@ -276,7 +276,7 @@ const maxProfit = (prices) => { dp[i][1] = Math.max(dp[i-1][1], dp[i-1][0] + prices[i]); } - return dp[prices.length -1][0]; + return dp[prices.length -1][1]; }; // 方法二:动态规划(滚动数组)