Skip to content

Commit 2546861

Browse files
committed
Runtime: 2 ms (Top 93.59%) | Memory: 83.9 MB (Top 46.18%)
1 parent ec40f96 commit 2546861

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/algorithms/B/Best Time to Buy and Sell Stock/Best Time to Buy and Sell Stock.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
// Runtime: 2 ms (Top 93.59%) | Memory: 83.9 MB (Top 46.18%)
12
class Solution {
23
public int maxProfit(int[] prices) {
34
int lsf = Integer.MAX_VALUE;
45
int op = 0;
56
int pist = 0;
6-
7+
78
for(int i = 0; i < prices.length; i++){
89
if(prices[i] < lsf){
910
lsf = prices[i];
@@ -15,4 +16,4 @@ public int maxProfit(int[] prices) {
1516
}
1617
return op;
1718
}
18-
}
19+
}

0 commit comments

Comments
 (0)