2350. Shortest Impossible Sequence of Rolls

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

Содержание

LeetCode problem 2350

class Solution:
    def shortestSequence(self, rolls: List[int], k: int) -> int:
        res = 1
        s = set()
        for v in rolls:
            s.add(v)
            if len(s) == k:
                res += 1
                s.clear()
        return res