Longest Substring Without Repeating Characters (Repeat Once Follow-up)

Longest Substring with One Character Allowed to Repeat Once

Given a string s, return the length of its longest contiguous substring in which at most one distinct character may occur twice, wh...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: