Best time to buy and sell a stock given a list of historic prices.
Given a list of daily prices, return the maximum profit achievable with exactly one buy followed by one sell. If no profitable transaction is possible, return 0. Implement max_profit(prices), where prices is a list of integers and the output is an integer.
def max_profit(prices):