Class Solution
java.lang.Object
g0901_1000.s0914_x_of_a_kind_in_a_deck_of_cards.Solution
914 - X of a Kind in a Deck of Cards.<p>Easy</p>
<p>In a deck of cards, each card has an integer written on it.</p>
<p>Return <code>true</code> if and only if you can choose <code>X >= 2</code> such that it is possible to split the entire deck into 1 or more groups of cards, where:</p>
<ul>
<li>Each group has exactly <code>X</code> cards.</li>
<li>All the cards in each group have the same integer.</li>
</ul>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> deck = [1,2,3,4,4,3,2,1]</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> Possible partition [1,1],[2,2],[3,3],[4,4].</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> deck = [1,1,1,2,2,2,3,3]</p>
<p><strong>Output:</strong> false</p>
<p><strong>Explanation:</strong> No possible partition.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= deck.length <= 10<sup>4</sup></code></li>
<li><code>0 <= deck[i] < 10<sup>4</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
hasGroupsSizeX
public boolean hasGroupsSizeX(int[] deck)
-