Greedily start sequences from the smallest available card.
Count occurrences. Iterate values in ascending order.
If cnt[x] = c > 0, we must start c groups at x, so subtract c from x..x+groupSize-1.
Any valid partition must place the smallest remaining card as the start of a group (it cannot appear later in a consecutive group).
Greedily start sequences from the smallest available card.
Count occurrences. Iterate values in ascending order.
If cnt[x] = c > 0, we must start c groups at x, so subtract c from x..x+groupSize-1.
Any valid partition must place the smallest remaining card as the start of a group (it cannot appear later in a consecutive group).