Problem 1278 · Hard

Palindrome Partitioning III

Price every substring by the letter changes it needs, then a layered DP chooses where to cut the string into k parts.

Open the interactive visualisation