Leetcode/python/minimum_operations_to_exceed_threshold_value_i.py

7 lines
208 B
Python
Raw Normal View History

2024-03-08 16:42:50 +00:00
class Solution:
def minOperations(self, nums: List[int], k: int) -> int:
heapify(nums)
operations = 0
while heappop(nums) < k:
operations += 1
return operations