Standard Bar Sliding Window · Medium Problems O(n) · O(m)
An aviation radio logs a continuous stream of call-sign characters, and the tower software highlights the longest stretch in which no character appears twice — such stretches can be bundled into a single transmission packet without ambiguity. The scanner slides a frame over the log, retreating its left edge just far enough whenever a duplicate sneaks in, and reports the widest clean frame it ever saw.
Input: A string s of characters.
Output: Return the length of the longest substring in which every character occurs exactly once.
0 <= s.length <= 5 * 10^4s may contain letters, digits, symbols and spacesInput: {"s":"abcabcbb"}
Output: 3
The cleanest stretch is "abc"; the fourth character repeats and forces a retreat.
Input: {"s":"bbbbb"}
Output: 1
Every pair repeats, so a single character is the widest unique frame.