409. Longest Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
This is case sensitive, for example"Aa"
is not considered a palindrome here.
Note: Assume the length of given string will not exceed 1,010.
Example:
Thoughts:
Total len - number of odds + 1 (indicator of whether odds > 0)
Code: Python
Code: Python with counting even number (slower)
Last updated
Was this helpful?