Solution for Merge Best Time to Buy and Sell Stock problem which is a part of Grind 75 list.
class Solution:
def maxProfit(self, prices: List[int]) -> int:
left = 0
right = 1
profit = 0
while right < len(prices):
curr_profit = prices[right] - prices[left]
if prices[left] < prices[right]:
profit = max(curr_profit, profit)
else:
left = right
right += 1
return profit