You are given an integer array nums and an integer k.
In one operation, you perform the following actions:
Select the two smallest integers x and y from nums.
Remove x and y from nums.
Add nums.
Return the minimum number of operations required so that every element in nums is greater than or equal to k.
Constraints:
nums.length
nums[i]
k
The input is generated such that an answer always exists, meaning that all elements in nums will eventually be greater than or equal to k after performing some number of operations.
You are given an integer array nums and an integer k.
In one operation, you perform the following actions:
Select the two smallest integers x and y from nums.
Remove x and y from nums.
Add nums.
Return the minimum number of operations required so that every element in nums is greater than or equal to k.
Constraints:
nums.length
nums[i]
k
The input is generated such that an answer always exists, meaning that all elements in nums will eventually be greater than or equal to k after performing some number of operations.