846-Hand-Of-Straights
Sat 17 May 2025
https://leetcode.com/problems/hand-of-straights
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def isNStraightHand(self, hand: List[int], W: int) -> bool:
count = Counter(hand)
for start in sorted(count):
value = count[start]
if value > 0:
for i in range(start, start + W):
count[i] -= value
if count[i] < 0:
return False
return True
new Solution().isNStraightHand()
Score: 5
Category: leetcode