Hand of Straights
Medium
Topics
Given an array hand of card values and a group size k (LeetCode: groupSize), return true if the cards can be rearranged into groups of k consecutive cards.
Example 1
Input: hand = [1,2,3,6,2,3,4,7,8], k = 3 Output: true
Example 2
Input: hand = [1,2,3,4,5], k = 4 Output: false
Constraints
- 1 <= hand.length <= 10^4
- 0 <= hand[i] <= 10^9
- 1 <= k
Run ⌘' · Submit ⌘⏎