Practice Minimum Operations to Exceed Threshold Value I
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed integer array nums, and an integer k. In one operation, you can remove one occurrence of the smallest element of nums. Return the minimum number of operations needed so that all elements of the array are greater than or equal to k.
Source: Minimum Operations to Exceed Threshold Value I on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [2,11,10,1,3], k = 10
Output
3
# Example 2
Input
nums = [1,1,2,4,9], k = 1
Output
0
# Example 3
Input
nums = [1,1,2,4,9], k = 9
Output
4
Constraints
1 <= nums.length <= 50
1 <= nums[i] <= 10^9
1 <= k <= 10^9
The input is generated such that there is at least one index i such that nums[i] >= k.
Related LeetCode Problems
Practice more problems similar to Minimum Operations to Exceed Threshold Value I.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.