From 2517bb603948d44767f629fed00a459663723d4c Mon Sep 17 00:00:00 2001 From: LiHua <1985390347@qq.com> Date: Wed, 24 Nov 2021 21:54:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E4=BA=86121=E3=80=81122?= =?UTF-8?q?=E3=80=81123=E3=80=81188md=E6=A0=BC=E5=BC=8F=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=A5=BD=E5=BF=83=E5=B9=B2=E4=BA=86=E5=9D=8F=E4=BA=8B?= =?UTF-8?q?=EF=BC=8C=E6=8A=8A=E5=8D=A1=E5=93=A5=E6=A0=BC=E5=BC=8F=E6=94=B9?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E5=90=93=E6=AD=BB=EF=BC=8C=E8=B5=B6=E7=B4=A7?= =?UTF-8?q?=E6=94=B9=E8=BF=87=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0121.买卖股票的最佳时机.md | 8 ++++---- problems/0122.买卖股票的最佳时机II.md | 14 ++++++++------ problems/0123.买卖股票的最佳时机III.md | 10 ++++------ problems/0188.买卖股票的最佳时机IV.md | 10 ++++++---- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/problems/0121.买卖股票的最佳时机.md b/problems/0121.买卖股票的最佳时机.md index 2815cd47..486e08bd 100644 --- a/problems/0121.买卖股票的最佳时机.md +++ b/problems/0121.买卖股票的最佳时机.md @@ -194,7 +194,7 @@ public: ## 其他语言版本 -### Java +Java: > 贪心法: @@ -264,7 +264,7 @@ class Solution { } ``` -### Python +Python: > 贪心法: ```python @@ -308,7 +308,7 @@ class Solution: return dp[(length-1) % 2][1] ``` -### Go +Go: ```Go func maxProfit(prices []int) int { @@ -336,7 +336,7 @@ func max(a,b int)int { } ``` -### JavaScript +JavaScript: > 动态规划 diff --git a/problems/0122.买卖股票的最佳时机II.md b/problems/0122.买卖股票的最佳时机II.md index e2464a03..1259aff7 100644 --- a/problems/0122.买卖股票的最佳时机II.md +++ b/problems/0122.买卖股票的最佳时机II.md @@ -131,7 +131,7 @@ public: ## 其他语言版本 -### Java +Java: ```java // 贪心思路 @@ -186,9 +186,8 @@ class Solution { } ``` +Python: - -### Python ```python class Solution: def maxProfit(self, prices: List[int]) -> int: @@ -212,7 +211,8 @@ class Solution: return dp[-1][1] ``` -### Go +Go: + ```golang //贪心算法 func maxProfit(prices []int) int { @@ -248,7 +248,8 @@ func maxProfit(prices []int) int { } ``` -### Javascript +Javascript: + 贪心 ```Javascript var maxProfit = function(prices) { @@ -284,7 +285,8 @@ const maxProfit = (prices) => { }; ``` -### C +C: + ```c int maxProfit(int* prices, int pricesSize){ int result = 0; diff --git a/problems/0123.买卖股票的最佳时机III.md b/problems/0123.买卖股票的最佳时机III.md index 3d67ec87..8fa3a8e0 100644 --- a/problems/0123.买卖股票的最佳时机III.md +++ b/problems/0123.买卖股票的最佳时机III.md @@ -188,7 +188,7 @@ dp[1] = max(dp[1], dp[0] - prices[i]); 如果dp[1]取dp[1],即保持买入股 ## 其他语言版本 -### Java +Java: ```java // 版本一 @@ -244,7 +244,7 @@ class Solution { } ``` -### Python +Python: > 版本一: ```python @@ -311,9 +311,7 @@ func max(a,b int)int{ } ``` - - -### JavaScript +JavaScript: > 版本一: @@ -352,7 +350,7 @@ const maxProfit = prices => { }; ``` -### Go +Go: > 版本一: ```go diff --git a/problems/0188.买卖股票的最佳时机IV.md b/problems/0188.买卖股票的最佳时机IV.md index 537ccd4a..615ebd5c 100644 --- a/problems/0188.买卖股票的最佳时机IV.md +++ b/problems/0188.买卖股票的最佳时机IV.md @@ -165,7 +165,7 @@ public: ## 其他语言版本 -### Java +Java: ```java // 版本一: 三维 dp数组 @@ -252,7 +252,8 @@ class Solution { } ``` -### Python +Python: + 版本一 ```python @@ -285,7 +286,8 @@ class Solution: dp[j] = max(dp[j],dp[j-1]+prices[i]) return dp[2*k] ``` -### Go +Go: + 版本一: ```go @@ -357,7 +359,7 @@ func max(a,b int)int{ } ``` -### Javascript +Javascript: ```javascript // 方法一:动态规划