mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			957 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			957 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<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>
 |