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 // 方法一:动态规划