Problem · String
Longest Palindromic Substring
Learn this problemProblem statement
Heads up! Original problem is from LeetCode 5. Note that in the original problem, a single character is also considered palindromic, so before printing, you just need to check if the length of the longest palindromic substring is 1. Otherwise, follow the original LeetCode problem as is.
Given a String s, return the longest palindromic substring in s.
Function
longestPalindromicSubstring(s: String) → StringExamples
Example 1
s = "babad"return = "bab""aba" is also a valid answer.
Example 2
s = "cbbd"return = "bb"🦊🦊
Constraints
1 <= s.length <= 1000s consist of only digits and English letters.More Cisco problems
- Collect CoinsSeen Jun 2025
- FizzBuzz ProblemSeen May 2025
- Find Largest Sum Contiguous SubarraySeen May 2025
- Find Largest Sum of Continuous SequenceSeen May 2025
- Find Palindrome Sub-stringSeen May 2025
- Count Numbers with Digit SumSeen Mar 2025
- Maximum Chocolates from Jars (L.C. 198 :)Seen Mar 2025
- Find Elements Largest in Row Smallest in ColumnSeen Mar 2025