Medium Problems3. Longest Substring Without Repeating Characters3. Longest Substring Without Repeating CharactersLeetcodehttps://leetcode.com/problems/longest-substring-without-repeating-characters/ Solutions Brute ForceSliding WindowSliding Window Optimizedfunction lengthOfLongestSubstring(s: string): number { function check(start: number, end:number) { let set = new Set(); for (let i = start; i < end + 1; i++) { let c = s[i]; if(set.has(c)) { return false; } set.add(c) } return true; } let res = 0; for (let i = 0; i < s.length; i++) { for(let j = i; j < s.length; j++) { if(check(i,j)) { res = Math.max(res, j - i + 1) } } } return res; }; Video Solution Last Update: 12:08 - 16 April 2024Hash TableStringSliding WindowPrevious1672. Richest Customer WealthNext7. Reverse IntegerOn this page