1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/卡牌分组 [x-of-a-kind-in-a-deck-of-cards].html
2022-03-29 12:43:11 +08:00

37 lines
1000 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一副牌,每张牌上都写着一个整数。</p>
<p>此时,你需要选定一个数字 <code>X</code>,使我们可以将整副牌按下述规则分成 1 组或更多组:</p>
<ul>
<li>每组都有&nbsp;<code>X</code>&nbsp;张牌。</li>
<li>组内所有的牌上都写着相同的整数。</li>
</ul>
<p>仅当你可选的 <code>X &gt;= 2</code> 时返回&nbsp;<code>true</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>deck = [1,2,3,4,4,3,2,1]
<strong>输出:</strong>true
<strong>解释:</strong>可行的分组是 [1,1][2,2][3,3][4,4]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>deck = [1,1,1,2,2,2,3,3]
<strong>输出:</strong>false
<strong>解释:</strong>没有满足要求的分组。
</pre>
<p><br />
<strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= deck.length &lt;= 10<sup>4</sup></code></li>
<li><code>0 &lt;= deck[i] &lt; 10<sup>4</sup></code></li>
</ul>