© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
18 replies
morry329#

❔ LeetCode 409 Longest Palindrome

So I have a very hard time trying to understand the logic/thought process behind this puzzle. The full puzzle description is here
https://leetcode.com/problems/longest-palindrome/?envType=study-plan&id=level-1

I understand I need to care about the middle chars (like for example if the string is "abcccab" the middle chars to care about are "ccc"). But I am totally stuck with how to go about the rest. I have watched a couple of videos explaining "add +1 to the length of the odd string" which left me rolling eyes. I need to apply foreach/for loops, sure I got it but I am generally puzzled with how to apply pointers to this puzzle.

Could anyone kindly explain the basic logic for this LC exercise
(no code example please) to me like you would do it to a 5 y/o?
LeetCode
Longest Palindrome - LeetCode
Longest Palindrome - Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.

Letters are case sensitive, for example, "Aa" is not considered a palindrome here.

 

Example 1:


Input: s = "abccccdd"
Output: 7
Explanation: One longest palindrome that can...
Longest Palindrome - LeetCode
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Palindrome
C#CC# / help
3y ago
❔ LeetCode Alternatives
C#CC# / help
3y ago
IndexOutOfRange Leetcode help
C#CC# / help
2y ago
✅ Help LeetCode Problem
C#CC# / help
3y ago