mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
33
leetcode/problem/x-of-a-kind-in-a-deck-of-cards.html
Normal file
33
leetcode/problem/x-of-a-kind-in-a-deck-of-cards.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<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> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> deck = [1,2,3,4,4,3,2,1]
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation</strong>: Possible partition [1,1],[2,2],[3,3],[4,4].
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> deck = [1,1,1,2,2,2,3,3]
|
||||
<strong>Output:</strong> false
|
||||
<strong>Explanation</strong>: No possible partition.
|
||||
</pre>
|
||||
|
||||
<p> </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>
|
Reference in New Issue
Block a user