Skip to content

Practice Minimum Operations to Halve Array Sum

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2208
LeetCode Problem

Minimum Operations to Halve Array Sum

Problem Statement

You are given an array nums of positive integers. In one operation, you can choose any number from nums and reduce it to exactly half the number. (Note that you may choose this reduced number in future operations.) Return the minimum number of operations to reduce the sum of nums by at least half.

Source: Minimum Operations to Halve Array Sum on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [5,19,8,1]
Output
3

# Example 2

Input
nums = [3,8,20]
Output
3

Constraints

1 <= nums.length <= 10^5
1 <= nums[i] <= 10^7

Related LeetCode Problems

Practice more problems similar to Minimum Operations to Halve Array Sum.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.