Stock trading with fee

Write codeMedium20 minBloomberg style

Your task

Given daily prices and a fixed transaction fee charged once per completed sell, find the maximum profit with unlimited transactions and at most one share held at a time. The fee is a non-negative integer. The price list may be empty.

Examples

stock_with_fee(prices: list[int], fee: int) -> int
Example 1
Inputstock_with_fee([1, 3, 2, 8, 4, 9], 2)
Output8