Stock trading k transactions
Your task
Given an integer k and daily prices, find the maximum profit with at most k completed transactions, holding at most one share at a time. k can be 0 and can exceed the number of days. The price list may be empty.
Examples
stock_k_transactions(k: int, prices: list[int]) -> intExample 1
Input
stock_k_transactions(2, [2, 4, 1])Output
2