text: class Solution {
  public:
      /**
       * @param prices: a list of integers
       * @param fee: a integer
       * @return: return a integer
       */
      int maxProfit(vector<int> &prices, int fee) {
          // write your code here
          int n = prices.size();
          int buy = -prices[0], sell = 0;
          for (int i = 1; i < n; ++i) {
              buy = max(buy, sell - prices[i]);
              sell = max(sell, buy + prices[i] - fee);
          }
          
          return sell;
      }
  };
  