python-algorithm

leetcode 3065. Minimum Operations to Exceed Threshold Value I

무적김두칠 2024. 4. 24. 07:52

https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/description/

 

1
2
3
4
5
class Solution:
    def minOperations(self, nums: List[int], k: int-> int:
        answer = [1 if num < k else 0 for num in nums ]
        return sum(answer)
        
cs
반응형