Medium
Longest Palindromic Substring
Medium
0 submissions
25 coins
+100 XP
Dynamic Programming
String
Two Pointers
Problem Description
Given a string `s`, return the longest palindromic substring in `s`.
A **palindrome** is a string that reads the same forward and backward.
**Example 1:**
```
Input: s = "babad"
Output: "bab"
Explanation: "aba" is also a valid answer.
```
**Example 2:**
```
Input: s = "cbbd"
Output: "bb"
```
**Example 3:**
```
Input: s = "a"
Output: "a"
```
Constraints
- 1 <= s.length <= 1000
- `s` consists of only lowercase English letters
Need help?
Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.
Video Call
Whiteboard
Live Coding
Screen Share