You are given an array prices where prices[i] is the price of a stock on day i.
prices
prices[i]
i
Choose one day to buy and a later day to sell to maximize profit. Return the maximum profit, or 0 if no profit is possible.
0
[7,1,5,3,6,4]
[7,6,4,3,1]
[2,4,1]
[1]