Longest Substring With One Character Allowed to Repeat Once

Asked at Pinduoduo · Coding Questions · Difficulty: Medium

Given a string `s`, return the length of its longest contiguous substring in which **at most one distinct character may occur twice**, while every other character occurs at most once.

Loading the problem…