❔ 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?
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 - 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...
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...
