2
* @param {number[]} prices6
var maxProfit = function (prices, fee) {7
let purchase = -1 * prices[0]; //If we purchase on 0th day8
let sell = 0; //If we sell on 0th day10
for (let i = 1; i < prices.length; i++) {11
prevPurchase = purchase;12
purchase = Math.max(purchase, sell - prices[i]); //If we purchase on ith day13
sell = Math.max(sell, prevPurchase + prices[i] - fee); //If we sell on ith day15
return sell; //If must return the best price whenever we sold stock because then only we can be at max profit.