121:买卖股票的最佳时机
This commit is contained in:
parent
73df49ad3d
commit
7fecd74df0
@ -52,6 +52,7 @@ public class BestTimeToBuyAndSellStock {
|
||||
for (int i = 1; i < prices.length; i++) {
|
||||
if (prices[i] > min) {
|
||||
max = Math.max(max, prices[i] - min);
|
||||
continue;
|
||||
}
|
||||
min = Math.min(min, prices[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user