Available question text
Given a lowercase string where you may swap any two characters once, find the maximum length of a substring consisting of the same character after at most one swap.
Think in terms of run-length groups and character counts: you can extend a run with extra occurrences elsewhere or merge two same-character runs separated by a single different char when a spare character exists.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1156. Swap For Longest Repeated Character Substring
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source