title: Best time to Buy and Sell stock modified version
body: <p>Say you have an array for which the ith element is the price of a given stock on day i.</p>
  
  <p>If you can do unlimited times of buy and sell (can only hold one stock at a time), but each time you sell you need to pay transaction fee, please calculate the maximum profit you can take.</p>
  
  <p>Sample input { 1, 3, 7, 5, 10, 3 } fee = 3.</p>
  
  <p>If you do two transactions, the total profit is (7 - 1) - 3 + (10 - 5) - 3 = 5.
  If you only to one transaction, the total profit is (10 - 1) - 3 = 6.</p>
  
  <pre><code>public int maxProfit(int[] prices, int fee) {}
  </code></pre>
  
  <p>The original version is pretty straightforward but I'm not sure how to approach this modified version. Can anyone give me some hints/guidance? I'm studying algorithm problems for interviews.</p>