Skip to content

Commit d733dc1

Browse files
committed
Sync LeetCode submission Runtime - 27 ms (90.14%), Memory - 26.9 MB (7.24%)
1 parent 2fc00b4 commit d733dc1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Approach 2: One Pass
22

3-
# Time: O(N)
3+
# Time: O(n)
44
# Space: O(1)
55

66
class Solution:
77
def maxProfit(self, prices: List[int]) -> int:
88
min_price = float('inf')
99
max_profit = 0
10-
10+
1111
for price in prices:
1212
if price < min_price:
1313
min_price = price
14-
elif price - min_price > max_profit:
14+
if price - min_price > max_profit:
1515
max_profit = price - min_price
16-
16+
1717
return max_profit
1818

0 commit comments

Comments
 (0)