2025-01-09 20:29:41 +08:00
< 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 >
2022-03-27 20:56:26 +08:00
2025-01-09 20:29:41 +08:00
< p > Letters are < strong > case sensitive< / strong > , for example, < code > " Aa" < / code > is not considered a palindrome.< / p >
2022-03-27 20:56:26 +08:00
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > s = " abccccdd"
< strong > Output:< / strong > 7
2023-12-09 18:42:21 +08:00
< strong > Explanation:< / strong > One longest palindrome that can be built is " dccaccd" , whose length is 7.
2022-03-27 20:56:26 +08:00
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 2:< / strong > < / p >
2022-03-27 20:56:26 +08:00
< pre >
< strong > Input:< / strong > s = " a"
< strong > Output:< / strong > 1
2023-12-09 18:42:21 +08:00
< strong > Explanation:< / strong > The longest palindrome that can be built is " a" , whose length is 1.
2022-03-27 20:56:26 +08:00
< / 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 >