Solo practiceA little space to think.
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"OUTPUT3

The section ‘cof’ has three different characters.

Example 2

INPUT"abcaef"OUTPUT5

The section ‘bcaef’ contains five different characters.

Keep in mind

  • 0 ≤ text.length ≤ 20,000
  • The string contains printable ASCII characters.
Your workspace
JavaScript
Draft saved on this browserSpaces: 2 UTF-8
Try an idea. See what happens.
INPUT"coffee"
EXPECTED OUTPUT3

Public samples only. These checks do not award ranked points.

The vibe
Your problem set 2 selected

Local preview · up to 6 tabs in this browser

A perfect pairArrays · Hash mapsEasyKeep it togetherStrings · StacksEasyTwo queues, one counterArrays · Two pointersEasySomething differentStrings · Sliding windowMediumIslands in the brewGraphs · Depth-first searchMediumThe long way homeGraphs · Shortest pathsHard
HackerBrewery

This is an early, local preview. Create a room, open its link in another tab in this browser, and try a session together. Room chat and sample progress update between those tabs.

Links do not connect different devices yet. Networked rooms, WebRTC, accounts, and ranked judging are still being built. Sample checks are public practice checks, not ranked verdicts.

Choose the name other tabs in your local room will see.