Search⌘ K
AI Features

Solution: Hand of Straights

C# solution for the Hand of Straights problem using the Heaps pattern.

Statement

You are given an integer array hand, where each value represents a card rank, and an integer groupSize. Determine whether it is possible to reorder hand so that it can be partitioned into groups of exactly groupSize cards, where each group consists of groupSize consecutive ranks.

Return true if such a partitioning is possible, otherwise return false.

Note: This problem is the same as LeetCode 12961296.

Constraints:

  • 11 \leq hand.length 1 ...