Problem 1043 · Medium

Partition Array for Maximum Sum

Split an array into contiguous blocks of at most k elements, replace each block by its maximum, and maximize the total. A dynamic table records the best total for each prefix length.

Open the interactive visualisation