Dsa
Two Pointers
Medium
Longest Distinct Character Subarray
Given a string s, find the length of the longest substring that contains all distinct characters.
Input: A single line containing the string. The length of the string will be between 1 and 100,000.
Output: Print a single integer representing the length of the longest distinct substring.
Example:
Input:
abca
Output:
3
Key concepts
two_pointerssliding_windowhashing
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