We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e5a462 commit 451d9b1Copy full SHA for 451d9b1
docs/notes/63. 股票的最大利润.md
@@ -12,7 +12,7 @@
12
13
## 解题思路
14
15
-使用贪心策略,假设第 i 轮进行卖出操作,买入操作价格应该在 i 之前并且价格最低。
+使用贪心策略,假设第 i 轮进行卖出操作,买入操作价格应该在 i 之前并且价格最低。因此在遍历数组时记录当前最低的买入价格,并且尝试将每个位置都作为卖出价格,取收益最大的即可。
16
17
```java
18
public int maxProfit(int[] prices) {
notes/63. 股票的最大利润.md
0 commit comments