python-algorithm

leetcode 2357. Make Array Zero by Subtracting Equal Amounts

무적김두칠 2024. 2. 9. 23:03

https://leetcode.com/problems/make-array-zero-by-subtracting-equal-amounts/description/

 

LeetCode - The World's Leading Online Programming Learning Platform

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

1
2
3
4
5
6
7
class Solution:
    def minimumOperations(self, nums: List[int]) -> int:
        nums = list(set(nums))
        if 0 in nums:
            nums.remove(0)
        
        return len(nums)
cs
반응형