Do a whiteboard coding problem and incorporate knowledge about financial markets.
For a concrete implementation, given a chronological list of prices for one security, return the maximum profit from one buy followed by one later sell. Implement the function below and return 0 when no profitable trade is possible. The input is a list of integers, and the output is an integer profit.
def max_profit(prices):