2
public boolean isNStraightHand(int[] hand, int groupSize) {3
if (hand.length % groupSize != 0) return false;5
Map<Integer, Integer> map = new HashMap<>();6
PriorityQueue<Integer> minHeap = new PriorityQueue<>();8
for (int card : hand) {9
if (map.containsKey(card)) map.put(card, map.get(card) + 1);16
while (!minHeap.isEmpty()) {17
int min = minHeap.peek();18
for (int i = min; i < min + groupSize; i++) {19
if (!map.containsKey(i) || map.get(i) == 0) return false;20
map.put(i, map.get(i) - 1);21
if (map.get(i) == 0) {22
if (minHeap.peek() != i) return false;