diff --git a/buyAndSellStock.py b/buyAndSellStock.py new file mode 100644 index 0000000..3d9d784 --- /dev/null +++ b/buyAndSellStock.py @@ -0,0 +1,11 @@ +# TC: O(n) +# SC: O(1) +class Solution: + def maxProfit(self, prices: List[int]) -> int: + profit=0 + n=len(prices) + for i in range(n-1): + if prices[i]