Longest Palindromic Substring

Medium
Strings Dynamic Programming Two Pointers
Given a string `s`, return the longest palindromic substring.

Constraints

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

Examples

Example 1:
Input: babad
Output:
Explanation: aba is also valid
Example 2:
Input: cbbd
Output:

Hints

Expand around center for each character.
Consider both odd and even length palindromes.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.