Dsa
Sliding Window
Easy
Maximum Unique Substring Length
Given a string containing uppercase letters only, find the length of the longest substring that contains only unique characters.
Write a function that takes a string and returns the length of the longest substring without repeating characters.
Input Format:
- A single line containing the string s (1 ≤ s ≤ 10^5).
Output Format:
- Output a single integer representing the length of the longest substring with all unique characters.
Example:
Input:
ABDEFGABJKL
Output:
7
In this example, the longest substring with all unique characters is "BDEFGAB" or any similar combination with maximum length.
Key concepts
sliding_windowstringset
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