Proficient Level
Implement the method longestUniqueSubstring that returns the length of the longest substring without repeated characters.
Find the longest contiguous substring where every character appears only once.
The task is designed to test careful handling of edge cases, not only the most common input.
- The result is a length, not the substring text.
- Character matching is case-sensitive.
- Move the left side of the window past duplicates.
Use a sliding window and a map of last-seen positions to keep the current window unique.