hand[i] is the number on card i. Return True if the cards can be split into groups of exactly group_size cards where each group holds consecutive numbers (4, 5, 6 is a group of size 3).
For hand = [1, 2, 3, 6, 2, 3, 4, 7, 8] and group_size = 3 the answer is True ([1, 2, 3], [2, 3, 4], [6, 7, 8]).
Example 1
Input:
is_n_straight_hand([1, 2, 3, 6, 2, 3, 4, 7, 8], 3)
Output:
True
Example 2
Input:
is_n_straight_hand([1, 2, 3, 4, 5], 4)
Output:
False
0 <= len(hand) <= 1000001 <= group_size <= 1000000 <= hand[i] <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.