Stock Prices

Current Day

-

Current Price

-

Min Price (Buy)

-
Day: -

Max Profit

0
Sell Day: -
Potential Profit: -
Click "Step" or "Play" to start the visualization
Current Day
Min Price (Buy)
Best Sell Day
Python Code
profit = 0
mini = prices[0]
for i in range(1, len(prices)):
    cost = prices[i] - mini
    profit = max(profit, cost)
    mini = min(mini, prices[i])
return profit