Tap here to switch tabs
Problem
Submissions

Problem: Swap For Longest Repeated Character Substring

med
30 min
Try to solve the Swap For Longest Repeated Character Substring problem.

Statement

Given a string text, you are allowed to swap any 22 characters at most 11 time.

Return the maximum length of a contiguous substring consisting of identical characters that can be obtained.

Constraints:

  • 1≤1 \leq text.length ≤2⋅104\leq 2 \cdot 10^4

  • text consists of lowercase English characters only.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Swap For Longest Repeated Character Substring

med
30 min
Try to solve the Swap For Longest Repeated Character Substring problem.

Statement

Given a string text, you are allowed to swap any 22 characters at most 11 time.

Return the maximum length of a contiguous substring consisting of identical characters that can be obtained.

Constraints:

  • 1≤1 \leq text.length ≤2⋅104\leq 2 \cdot 10^4

  • text consists of lowercase English characters only.