Leetcode 1000. Minimum Cost to Merge Stones
Given n piles where you can repeatedly merge exactly k consecutive piles at cost equal to their sum, compute the minimum total cost to merge all piles into one (or return -1 if impossible — possible only when (n-1) % (k-1) == 0). This is typically solved with interval dynamic programming that computes the minimum cost to reduce subarrays to a certain number of piles.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.