You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
This solution gets accepted when it shouldn't:
class Solution:
def isNStraightHand(self, hand: List[int], groupSize: int) -> bool:
if len(hand) % groupSize != 0:
return False
counts = Counter(hand)
groups = 0
for num in hand:
i = 0
while i < groupSize and counts[num + i]:
i += 1
if i == groupSize:
groups += 1
for new_num in range(num, num + i):
counts[new_num] -= 1
return groups == len(hand)//groupSize
how ever this solution does not begin forming groups with the smallest number therefore it should fail and it does fail for this test case which is not included: hand = [8,8,9,7,7,7,6,7,10,6], groupSize = 2
The text was updated successfully, but these errors were encountered:
Bug Report for https://neetcode.io/problems/hand-of-straights
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
This solution gets accepted when it shouldn't:
how ever this solution does not begin forming groups with the smallest number therefore it should fail and it does fail for this test case which is not included: hand = [8,8,9,7,7,7,6,7,10,6], groupSize = 2
The text was updated successfully, but these errors were encountered: