hardSliding window2 bugs
Boss: The "abba" Trap
Boss level — two bugs. The longest-unique-substring service is wrong for "abba" and for every string.
longestUnique(s) returns the length of the longest substring without repeated characters.
Fix the code so every test passes. Keep the function name longestUnique.
Test cases
- longestUnique("abcabcbb") → 3
- longestUnique("bbbbb") → 1
- longestUnique("pwwkew") → 3
- longestUnique("abba") → 2
- longestUnique("") → 0
Hints
each hint costs XPStuck? Hints go from a nudge to the exact fix.