Problem 1000 · Hard

Minimum Cost to Merge Stones

Repeatedly merge exactly k neighbouring piles into one pile, paying their combined size each time, and find the lowest total cost to reach a single pile. An interval table shows which contiguous ranges can be collapsed.

Open the interactive visualisation