Logo
Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Problem 4: 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. You don't need to return the palindrome itself, just its maximum possible length.

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!