Best Time to Buy and Sell Stock with Transaction Fee
You are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee representing a transaction fee.
You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock, as well as pay the transaction fee for each transaction.
Return the maximum profit you can achieve.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)