BackmediumStrings

Longest Distinct Character Substring Solution

Problem Statement

Given a string `s`, find the length of the longest contiguous substring that contains only unique characters (i.e., no character appears more than once in the substring).

Example 1
Input
s = "abcabcbb"
Output
3

Explanation: The longest contiguous substring without repeating characters is "abc", which has a length of 3.

Constraints

  • 0 <= s.length <= 5 * 10^4
  • s consists of printable ASCII characters.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free