Problem
You hold a hand of cards, hand[i] being the value on card i. Decide whether you can split all of the cards into groups of exactly group_size cards, where each group is a run of consecutive values (like 4, 5, 6). Return true or false.
Example 1
- Input
- hand = [1, 2, 3, 6, 2, 3, 4, 7, 8], group_size = 3
- Output
- true
- Why
- [1,2,3] [2,3,4] [6,7,8]
Example 2
- Input
- hand = [1, 2, 3, 4, 5], group_size = 4
- Output
- false
- Why
- 5 cards cannot fill groups of 4
Constraints
1 <= hand.length <= 10^40 <= hand[i] <= 10^91 <= group_size <= hand.length