Cascadiq

Longest Palindromic Substring

algorithm · Level 3 · 30 min

Description

Given a string s, return the longest palindromic substring in s.

A palindrome reads the same forward and backward.

Requirements

  • Implement a function that takes a string s.
  • Return the longest substring of s that is a palindrome.
  • If there are multiple, return any one.

Constraints

- `1 <= s.length <= 1000` - `s` consists only of digits and English letters.

Deliverables

Return the longest palindromic substring.

Tags

StringDynamic Programming