mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-13 01:15:14 +08:00
update
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<p>You are given an <strong>1-indexed</strong> integer array <code>prices</code> where <code>prices[i]</code> denotes the number of coins needed to purchase the <code>i<sup>th</sup></code> fruit.</p>
|
||||
<p>You are given an <strong>0-indexed</strong> integer array <code>prices</code> where <code>prices[i]</code> denotes the number of coins needed to purchase the <code>(i + 1)<sup>th</sup></code> fruit.</p>
|
||||
|
||||
<p>The fruit market has the following reward for each fruit:</p>
|
||||
|
||||
<ul>
|
||||
<li>If you purchase the <code>i<sup>th</sup></code> fruit at <code>prices[i]</code> coins, you can get any number of the next <code>i</code> fruits for free.</li>
|
||||
<li>If you purchase the <code>(i + 1)<sup>th</sup></code> fruit at <code>prices[i]</code> coins, you can get any number of the next <code>i</code> fruits for free.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Note</strong> that even if you <strong>can</strong> take fruit <code>j</code> for free, you can still purchase it for <code>prices[j]</code> coins to receive its reward.</p>
|
||||
<p><strong>Note</strong> that even if you <strong>can</strong> take fruit <code>j</code> for free, you can still purchase it for <code>prices[j - 1]</code> coins to receive its reward.</p>
|
||||
|
||||
<p>Return the <strong>minimum</strong> number of coins needed to acquire all the fruits.</p>
|
||||
|
||||
|
Reference in New Issue
Block a user