未验证 提交 18de1226 编写于 作者: K KEQI HUANG 提交者: GitHub

Update 121._Best_Time_to_Buy_and_Sell_Stock.md

上级 a314012c
......@@ -19,7 +19,8 @@ Here, the logic is to calculate the difference ```(maxCur += prices[i] - prices[
of the original array, and find a contiguous subarray giving maximum profit.
If the difference falls below ```0```, reset it to zero.
参考[Maximum subarray problem](https://en.wikipedia.org/wiki/Maximum_subarray_problem),
[Kadane's Algorithm](https://discuss.leetcode.com/topic/19853/kadane-s-algorithm-since-no-one-has-mentioned-about-this-so-far-in-case-if-interviewer-twists-the-input)
```python
class Solution(object):
def maxProfit(self, prices):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册