input: Write a function to find the maximum profit that can be achieved by buying and selling a single stock, given a list of stock prices.
  assert max_profit([10, 7, 5, 8, 11, 9]) == 6
  assert max_profit([7, 1, 5, 3, 6, 4]) == 5
  assert max_profit([7, 6, 4, 3, 1]) == 0
output: def max_profit(prices):
      if not prices:
          return 0
      
      min_price = prices[0]
      max_profit = 0
      
      for price in prices:
          min_price = min(min_price, price)
          max_profit = max(max_profit, price - min_price)
      
      return max_profit