mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<p>Return<em> the <strong>minimum</strong> number of operations to reduce the sum of </em><code>nums</code><em> by <strong>at least</strong> half.</em></p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [5,19,8,1]
|
||||
@@ -19,7 +19,7 @@ Overall, 3 operations were used so we return 3.
|
||||
It can be shown that we cannot reduce the sum by at least half in less than 3 operations.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [3,8,20]
|
||||
@@ -30,7 +30,7 @@ Pick the number 20 and reduce it to 10.
|
||||
Pick the number 10 and reduce it to 5.
|
||||
Pick the number 3 and reduce it to 1.5.
|
||||
The final array is [1.5, 8, 5] with a total sum of 1.5 + 8 + 5 = 14.5.
|
||||
The sum of nums has been reduced by 31 - 14.5 = 16.5, which is at least half of the initial sum, 16.5 >= 31/2 = 16.5.
|
||||
The sum of nums has been reduced by 31 - 14.5 = 16.5, which is at least half of the initial sum, 16.5 >= 31/2 = 15.5.
|
||||
Overall, 3 operations were used so we return 3.
|
||||
It can be shown that we cannot reduce the sum by at least half in less than 3 operations.
|
||||
</pre>
|
||||
|
Reference in New Issue
Block a user