Skip to content

Commit 1b39dcc

Browse files
committed
demo commit
1 parent cbb0999 commit 1b39dcc

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/learn/freq01/BestTimetoBuyandSellStock.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
//Say you have an array for which the ith element is the price of a given stock on day i.
44
//
55
//If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
6-
//只买卖1次 或者0次 求最大利润
7-
//找到最大增长即可。(不一定要连续的)
8-
//从前往后,用当前价格减去此前最低价格,就是在当前点卖出股票能获得的最高利润。
9-
//扫描的过程中更新最大利润和最低价格就行了。
6+
107
public class BestTimetoBuyandSellStock {
118
public int maxProfit(int[] prices) {
129
if (prices == null || prices.length == 0) {

0 commit comments

Comments
 (0)