diff --git a/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README.md b/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README.md index 2d217f0be055f..8092ac4ba8894 100644 --- a/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README.md +++ b/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README.md @@ -116,12 +116,12 @@ public: ```go func maxProfit(prices []int) (ans int) { - mi := prices[0] + mi, ans := prices[0] ,0 for _, v := range prices { ans = max(ans, v-mi) mi = min(mi, v) } - return + return ans } ``` diff --git a/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README_EN.md b/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README_EN.md index 98b8519df4f52..aeb77989e8f92 100644 --- a/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README_EN.md +++ b/solution/0100-0199/0121.Best Time to Buy and Sell Stock/README_EN.md @@ -114,12 +114,12 @@ public: ```go func maxProfit(prices []int) (ans int) { - mi := prices[0] + mi, ans := prices[0] ,0 for _, v := range prices { ans = max(ans, v-mi) mi = min(mi, v) } - return + return ans } ``` diff --git a/solution/0100-0199/0121.Best Time to Buy and Sell Stock/Solution.go b/solution/0100-0199/0121.Best Time to Buy and Sell Stock/Solution.go index 3ad626bf456d6..cc3c671886cb0 100644 --- a/solution/0100-0199/0121.Best Time to Buy and Sell Stock/Solution.go +++ b/solution/0100-0199/0121.Best Time to Buy and Sell Stock/Solution.go @@ -1,8 +1,8 @@ func maxProfit(prices []int) (ans int) { - mi := prices[0] + mi, ans := prices[0] ,0 for _, v := range prices { ans = max(ans, v-mi) mi = min(mi, v) } - return + return ans } \ No newline at end of file