Write an efficient function that takes yesterday's stock prices as a list and returns the best profit I could have made from 1 purchase and 1 sale of the stock yesterday.
Implement def max_profit(prices):. Return the maximum profit as an integer, or 0 if no profitable transaction is possible. The sale must occur after the purchase, and the input contains at least two prices.
def max_profit(prices):