This question evaluates understanding of dynamic programming and state-machine reasoning for constrained optimization, focusing on handling cooldown periods, transaction fees, and in-place O(1) space updates.
Given an array prices of daily stock prices, you may make at most two complete transactions (buy then sell). After each sell, there is a mandatory one-day cooldown during which you cannot buy, and each sell incurs a transaction fee fee. Compute the maximum achievable profit in O(n) time and O(