mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>Given a string <code>s</code> which consists of lowercase or uppercase letters, return the length of the <strong>longest <span data-keyword="palindrome-string">palindrome</span></strong> that can be built with those letters.</p>
 | 
						|
 | 
						|
<p>Letters are <strong>case sensitive</strong>, for example, <code>"Aa"</code> is not considered a palindrome.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> s = "abccccdd"
 | 
						|
<strong>Output:</strong> 7
 | 
						|
<strong>Explanation:</strong> One longest palindrome that can be built is "dccaccd", whose length is 7.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong class="example">Example 2:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> s = "a"
 | 
						|
<strong>Output:</strong> 1
 | 
						|
<strong>Explanation:</strong> The longest palindrome that can be built is "a", whose length is 1.
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</strong></p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>1 <= s.length <= 2000</code></li>
 | 
						|
	<li><code>s</code> consists of lowercase <strong>and/or</strong> uppercase English letters only.</li>
 | 
						|
</ul>
 |