mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<p>There are <code>n</code> piles of <code>stones</code> arranged in a row. The <code>i<sup>th</sup></code> pile has <code>stones[i]</code> stones.</p>
|
||||
|
||||
<p>A move consists of merging exactly <code>k</code> consecutive piles into one pile, and the cost of this move is equal to the total number of stones in these <code>k</code> piles.</p>
|
||||
<p>A move consists of merging exactly <code>k</code> <strong>consecutive</strong> piles into one pile, and the cost of this move is equal to the total number of stones in these <code>k</code> piles.</p>
|
||||
|
||||
<p>Return <em>the minimum cost to merge all piles of stones into one pile</em>. If it is impossible, return <code>-1</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> stones = [3,2,4,1], k = 2
|
||||
@@ -17,7 +17,7 @@ We merge [5, 5] for a cost of 10, and we are left with [10].
|
||||
The total cost was 20, and this is the minimum possible.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> stones = [3,2,4,1], k = 3
|
||||
@@ -25,7 +25,7 @@ The total cost was 20, and this is the minimum possible.
|
||||
<strong>Explanation:</strong> After any merge operation, there are 2 piles left, and we can't merge anymore. So the task is impossible.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> stones = [3,5,1,2,6], k = 3
|
||||
|
Reference in New Issue
Block a user