mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										19
									
								
								算法题(国外版)/reorganize-string.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								算法题(国外版)/reorganize-string.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
<p>Given a string <code>s</code>, rearrange the characters of <code>s</code> so that any two adjacent characters are not the same.</p>
 | 
			
		||||
 | 
			
		||||
<p>Return <em>any possible rearrangement of</em> <code>s</code> <em>or return</em> <code>""</code> <em>if not possible</em>.</p>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
<pre><strong>Input:</strong> s = "aab"
 | 
			
		||||
<strong>Output:</strong> "aba"
 | 
			
		||||
</pre><p><strong>Example 2:</strong></p>
 | 
			
		||||
<pre><strong>Input:</strong> s = "aaab"
 | 
			
		||||
<strong>Output:</strong> ""
 | 
			
		||||
</pre>
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Constraints:</strong></p>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
	<li><code>1 <= s.length <= 500</code></li>
 | 
			
		||||
	<li><code>s</code> consists of lowercase English letters.</li>
 | 
			
		||||
</ul>
 | 
			
		||||
		Reference in New Issue
	
	Block a user