Best time to buy and sell stock.
Implement max_profit(prices) to return the maximum profit from exactly one buy followed by one sell, or 0 if no profit is possible. Input is a list of daily prices, and the output is an integer. Examples include [7, 1, 5, 3, 6, 4] -> 5 and [7, 6, 4, 3, 1] -> 0. Use 2 <= len(prices) <= 1000 and 0 <= prices[i] <= 10^4.
def max_profit(prices):