This question evaluates algorithm design skills, specifically understanding of dynamic programming and greedy strategies for optimizing profit under transaction fees, along with stateful decision-making and handling cost constraints.

You are given an array prices where prices[i] is the price of a stock on day i and an integer fee representing the commission charged when you sell. You may complete as many transactions as you like (buy one and later sell one share), but you must sell before you buy again and can hold at most one share at a time. Return the maximum net profit achievable. Describe your algorithm and analyze time and space complexity. Follow-ups: How would the solution change if the fee were charged on both buy and sell, or if multiple shares could be held concurrently?