We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec40f96 commit 2546861Copy full SHA for 2546861
scripts/algorithms/B/Best Time to Buy and Sell Stock/Best Time to Buy and Sell Stock.java
@@ -1,9 +1,10 @@
1
+// Runtime: 2 ms (Top 93.59%) | Memory: 83.9 MB (Top 46.18%)
2
class Solution {
3
public int maxProfit(int[] prices) {
4
int lsf = Integer.MAX_VALUE;
5
int op = 0;
6
int pist = 0;
-
7
+
8
for(int i = 0; i < prices.length; i++){
9
if(prices[i] < lsf){
10
lsf = prices[i];
@@ -15,4 +16,4 @@ public int maxProfit(int[] prices) {
15
16
}
17
return op;
18
-}
19
+}
0 commit comments