Skip to content

Practice Find Longest Awesome Substring

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#1542
LeetCode Problem

Find Longest Awesome Substring

Problem Statement

You are given a string s. An awesome substring is a non-empty substring of s such that we can make any number of swaps in order to make it a palindrome. Return the length of the maximum length awesome substring of s.

Source: Find Longest Awesome Substring on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "3242415"
Output
5

# Example 2

Input
s = "12345678"
Output
1

# Example 3

Input
s = "213123"
Output
6

Constraints

1 <= s.length <= 10^5
s consists only of digits.

Related LeetCode Problems

Practice more problems similar to Find Longest Awesome Substring.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.