본문 바로가기
python-algorithm

leetcode 2357. Make Array Zero by Subtracting Equal Amounts

by 무적김두칠 2024. 2. 9.

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
반응형

'python-algorithm' 카테고리의 다른 글

leetcode 3024. Type of Triangle  (0) 2024.02.13
leetcode 3033. Modify the Matrix  (1) 2024.02.13
leetcode 2586. Count the Number of Vowel Strings in Range  (0) 2024.02.09
백준 Not A + B  (0) 2024.02.09
백준 27465 소수가 아닌 수  (0) 2024.02.09

댓글