input: from typing import List
  
  def max_revenue(prices: List[int]) -> int:
      """ Calculate the maximum revenue that can be obtained by buying and selling
      stocks on different days. The input is a list of stock prices where the i-th
      element represents the stock price on the i-th day. The function returns the
      maximum revenue that can be achieved by buying on one day and selling on
      another day.
      >>> max_revenue([10, 7, 5, 8, 11, 9])
      6
      >>> max_revenue([1, 2, 3, 4, 5])
      4
      """
output:     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