mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given an array filled with letters and numbers, find the longest subarray with an equal number of letters and numbers.</p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p>Return the subarray. If there are more than one answer, return the one which has the smallest index of its left endpoint. If there is no answer, return an empty arrary.</p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p><strong>Example 1:</strong></p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<pre>
 | 
						|
 | 
						|
<strong>Input: </strong>["A","1","B","C","D","2","3","4","E","5","F","G","6","7","H","I","J","K","L","M"]
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<strong>Output: </strong>["A","1","B","C","D","2","3","4","E","5","F","G","6","7"]
 | 
						|
 | 
						|
</pre>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p><strong>Example 2:</strong></p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<pre>
 | 
						|
 | 
						|
<strong>Input: </strong>["A","A"]
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<strong>Output: </strong>[]
 | 
						|
 | 
						|
</pre>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<p><strong>Note: </strong></p>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
<ul>
 | 
						|
 | 
						|
	<li><code>array.length <= 100000</code></li>
 | 
						|
 | 
						|
</ul>
 | 
						|
 |