Longest Palindromic Part
Return the longest palindromic substring of s. If several have the maximum length, return the one that starts first.
Requirements
- by expanding around every centre (there are centres).
Examples
EXAMPLE WALKTHROUGHtwo candidates
A guided view of the published example, not a trace of your code.
INPUT
["babad"]TASKlongest_palindromic_part()
EXPECTED OUTPUT
"bab"Start with the input values shown in this example.
Example 1 of 3
Input: s = "babad"
Output: "bab"
Explanation: two candidates
Input: s = "cbbd"
Output: "bb"
Explanation: even length
Input: s = "a"
Output: "a"
Explanation: single
Hint 1
Expand outwards from each character (odd length) and each gap between characters (even length).