A HACKERBREWERY ORIGINAL
Something different
MediumStringsSliding window
Find the length of the longest contiguous section of a string that contains no repeated characters. Return its length, not the section itself. Characters are case-sensitive; spaces count as characters.
Example 1
INPUT
"coffee"OUTPUT3The section ‘cof’ has three different characters.
Example 2
INPUT
"abcaef"OUTPUT5The section ‘bcaef’ contains five different characters.
Keep in mind
- 0 ≤ text.length ≤ 20,000
- The string contains printable ASCII characters.
Draft saved on this browserSpaces: 2 UTF-8
INPUT
"coffee"EXPECTED OUTPUT
3Public samples only. These checks do not award ranked points.