You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Given a string <code>s</code> which consists of lowercase or uppercase letters, return the length of the <strong>longest <spandata-keyword="palindrome-string">palindrome</span></strong> that can be built with those letters.</p>
2
+
3
+
<p>Letters are <strong>case sensitive</strong>, for example, <code>"Aa"</code> is not considered a palindrome.</p>
4
+
5
+
<p> </p>
6
+
<p><strongclass="example">Example 1:</strong></p>
7
+
8
+
<pre>
9
+
<strong>Input:</strong> s = "abccccdd"
10
+
<strong>Output:</strong> 7
11
+
<strong>Explanation:</strong> One longest palindrome that can be built is "dccaccd", whose length is 7.
12
+
</pre>
13
+
14
+
<p><strongclass="example">Example 2:</strong></p>
15
+
16
+
<pre>
17
+
<strong>Input:</strong> s = "a"
18
+
<strong>Output:</strong> 1
19
+
<strong>Explanation:</strong> The longest palindrome that can be built is "a", whose length is 1.
20
+
</pre>
21
+
22
+
<p> </p>
23
+
<p><strong>Constraints:</strong></p>
24
+
25
+
<ul>
26
+
<li><code>1 <= s.length <= 2000</code></li>
27
+
<li><code>s</code> consists of lowercase <strong>and/or</strong> uppercase English letters only.</li>
0 commit comments