Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

X of a Kind in a Deck of Cards

XPChallenge Points: 10
levelLevel: Easy

You are given an integer array deck, where deck[i] represents the number written on the i-th card.
You need to partition all cards into one or more groups such that:
1. Each group contains exactly X cards, where X > 1, and
2. All the cards in the same group have the same integer value.
Return True if it is possible to make such a partition, otherwise False.

Example 1:

Input: deck = [1,2,3,4,4,3,2,1]

Output: True

Example 2:

Input: deck = [1,1,1,2,2,2,3,3]

Output: False

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result