Tap here to switch tabs
Problem
Submissions

Problem: Hand of Straights

med
30 min
Try to solve the Hand of Straights problem.

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:

  • 1≤1 \leq hand.length ≤104\leq 10^4

  • 0≤0 \leq hand[i] ≤109\leq 10^9

  • 1≤1 \leq groupSize ≤\leq hand.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Hand of Straights

med
30 min
Try to solve the Hand of Straights problem.

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:

  • 1≤1 \leq hand.length ≤104\leq 10^4

  • 0≤0 \leq hand[i] ≤109\leq 10^9

  • 1≤1 \leq groupSize ≤\leq hand.length