Dsa
Sliding Window
Warm-up
Distinct Character Substring
Given a string s, find the length of the longest substring with all distinct characters.
For example, if the input is "abcabcbb", the output should be 3 because the longest substring with distinct characters is "abc".
Input Format:
- A single line containing the string s (1 ≤ |s| ≤ 10^5).
Output Format:
- A single integer representing the length of the longest substring with all distinct characters.
Example:
Input:
abcabcbb
Output:
3
Key concepts
sliding_windowstringcounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now