← Back to all problems
Medium

Longest Palindromic Substring Length

Updated Feb 24, 2026

Problem

Return the length of the longest palindromic substring.

Constraints

1 <= s.length <= 1000

Examples

Example 1

Input: {"s": "babad"}
Output: 3

Function Signature

def longestPalindromeLength(self, s: str) -> int

How to Submit

Implement a Solution class with a longestPalindromeLength method.

Your method will be called with the input parameters and should return the answer.