As reported: PayPal SE3, DSA round (2025): find a palindromic substring of an input string — pseudocode and edge cases, no full coding.
Given a string s, return the longest substring of s that is a palindrome.
This is LeetCode 5 — Longest Palindromic Substring.
Example 1
s = "babad" -> "bab" ("aba" is also accepted)
Example 2
s = "cbbd" -> "bb"
Constraints: 1 ≤ s.length ≤ 1000; s has only digits and English letters.
Code runner format: one line, s as a JSON string. Implement longestPalindrome(s); the harness accepts any longest palindromic substring and prints "ok".