Skip to content

Commit e6658bb

Browse files
committed
docs: update space complexity
1 parent 7f4ce76 commit e6658bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

best-time-to-buy-and-sell-stock/hyogshin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
- dp로 해당 날짜까지 가장 큰 수익을 저장
66
시간 복잡도: O(n)
77
- for 문 하나 -> O(n)
8-
공간 복잡도: O(n)
9-
- dp 리스트 -> O(n)
8+
공간 복잡도: O(1)
9+
- 상수 변수만 사용 -> O(1)
1010
'''
1111

1212
class Solution:
@@ -17,4 +17,5 @@ def maxProfit(self, prices: List[int]) -> int:
1717
least = min(prices[i], least)
1818
largest = max(prices[i] - least, largest)
1919
return largest
20-
20+
21+

0 commit comments

Comments
 (0)