<h3><a title="题目描述" href="https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock/">题目描述</a></h3>
![file](https://i.loli.net/2019/11/03/3XHQySzbLRrlIiM.png)
<h4>解法:</h4>
<pre class="EnlighterJSRAW" data-enlighter-language="null">class Solution:
def maxProfit(self, prices: List[int]) -> int:
temp = max_profit = 0
for i in range(len(prices) - 1):
temp = max(0, prices[i + 1] - prices[i] + temp)
max_profit = max(max_profit, temp)
return max_profit</pre>
#### Note
- 动态规划问题吃的不是很透,或者说还没入门
- 写这个题写了好久。
- 又懒又菜。
Leetcode121 买卖股票的最佳时期[dp]