2244. Minimum Rounds to Complete All Tasks

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2244

class Solution:
    def minimumRounds(self, tasks: List[int]) -> int:
        cnt = Counter(tasks)
        res = 0
        for v in cnt.values():
            if v == 1:
                return -1
            res += v // 3 + (v % 3 != 0)
        return res