Question
Return the longest contiguous palindromic substring of s. If several have the maximum length, return the one that starts at the earliest index. For the empty string return the empty string. For example "babad" returns "bab" (the earliest-starting of the two length-3 answers). Strings can be up to ~1000 characters; an O(n^2) expand-around-center solution is acceptable.
longest_palindrome(s: str) → str["babad"]out"bab"State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.