Problem 2911 · Hard
Precompute the change cost of every substring as a semi-palindrome, then DP over the number of parts.
Open the interactive visualisation