Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Solution: Longest Palindrome(easy)

Problem Statement:

Given a string, determine the length of the longest palindrome that can be constructed using the characters from the string. Return the maximum possible length of the palindromic string.

Examples:

    • Input: "applepie"
    • Expected Output: 5
    • Justification: The longest palindrome that can be constructed from the string is "pepep", which has a length of 5. There are are other palindromes too but they all will be of length 5.
    • Input: "aabbcc"
    • Expected Output: 6

.....

.....

.....

Like the course? Get enrolled and start learning!