LeetCode Solutions/LeetCoding Challenge/March 2020 LeetCoding Challenge/Best Time to Buy and Sell Stock with Transaction Fee.java
<reponame>DevashishPathrabe/LeetCodeclass Solution {
    public int maxProfit(int[] prices, int fee) {
        int buying = 0, selling = -prices[0];
        for(int i=1; i<prices.length; i++){
            buying = Math.max(buying, selling + prices[i] - fee);
            selling = Math.max(selling, buying - prices[i]);
        }
        return buying;
    }
}