You are given an integer array prices where prices[i] is the price of a given stock on the costs of the same length cooldown.
You want to maximize your profit by trading the stock according to the following rules:
You may complete as many transactions as you like, but you cannot hold more than
If you buy the stock on day costs[j - i]. The profit obtained from this transaction is prices[j] prices[i] costs[j - i].
After selling the stock on day cooldown days is required. This means the next purchase can only be made on or after day cooldown
Return the maximum profit you can achieve.
Constraints:
prices.length
costs.length
prices[i]
cooldown
costs[i]
You are given an integer array prices where prices[i] is the price of a given stock on the costs of the same length cooldown.
You want to maximize your profit by trading the stock according to the following rules:
You may complete as many transactions as you like, but you cannot hold more than
If you buy the stock on day costs[j - i]. The profit obtained from this transaction is prices[j] prices[i] costs[j - i].
After selling the stock on day cooldown days is required. This means the next purchase can only be made on or after day cooldown
Return the maximum profit you can achieve.
Constraints:
prices.length
costs.length
prices[i]
cooldown
costs[i]