Easy
Quiz
#409 Longest Palindrome
APPROACH
Given a string s composed of lowercase and uppercase letters, determine the longest palindrome that can be constructed using any subset of those characters. Letter case matters: 'A' and 'a' are considered different characters.
Example 1:
Input: s = "abccccdd"
Output: 7
Explanation: One longest palindrome that can be built is "dccaccd", whose length is 7.
Example 2:
Input: s = "a"
Output: 1
Explanation: The longest palindrome that can be built is "a", whose length is 1.
1 of 4
1:00
What is the optimal approach for this problem?