2350. Shortest Impossible Sequence of Rolls

Updated: 2024-03-12
1 min read
[]

On This Page

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