Longest Run Without Repeats

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

Given a string, find the length of the longest stretch of consecutive characters in which no character appears twice. For example, in "abcabcbb" the answer is three. Explain your approach and its cost.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →