Longest Substring
Medium · Phone screen · Onsite · Full-time
Pretty standard sliding window question from my Microsoft phone interview. Find the length of the longest substring without any repeating characters. I used a hash map to track the last index of each character and moved the left pointer forward whenever I hit a duplicate. The interviewer probed edge cases like an empty string, a string with all identical characters, and asked about the space complexity when the character set is ASCII versus Unicode.
