3012. Minimize Length of Array Using Operations

3012. Minimize Length of Array Using Operations

class Solution:
    def minimumArrayLength(self, nums: List[int]) -> int:
        v=min(nums)

        for x in nums:
            if x%v:
                return 1
        return (nums.count(v)+1)//2

1%3=1

3%1=0

你可能感兴趣的:(leetcode)