You are given an integer array stones where stones[i] represents the number of stones in the k.
In each operation, you can choose exactly k consecutive piles and merge them into a single pile. The cost of this operation is the sum of the stones in those k piles.
Return the minimum cost to merge all piles into one single pile. If it is impossible to merge all piles into one pile, return
Constraints:
n stones.length
n
stones[i]
k
You are given an integer array stones where stones[i] represents the number of stones in the k.
In each operation, you can choose exactly k consecutive piles and merge them into a single pile. The cost of this operation is the sum of the stones in those k piles.
Return the minimum cost to merge all piles into one single pile. If it is impossible to merge all piles into one pile, return
Constraints:
n stones.length
n
stones[i]
k