Best Time to Buy and Sell Stock IV
viaLeetCode
Given an array of prices and an integer k, find the maximum profit achievable with at most k buy-sell transactions (no overlapping transactions). Dynamic programming over transactions and days: dp[t][d] tracks best profit, or the optimized buy/sell rolling arrays.
asked …