Given a string s, find the length of the longest substring without repeating characters.
Example 1
Input: s = "geeksforgeeks"
Output: 7
Explanation: Longest substring is "eksforg".
Example 2
Input: s = "abdefgabef"
Output: 6
Explanation: Longest substring are "abdefg" , "bdefga" and "defgab".
Example 3
Input: s = "aaaaa"
Output: 1
Explanation: Longest substring is "a".
Approach, complexity and clean code in every language. Sign in to unlock the editorial.
Your submissions, results and runtime history live here. Sign in to start your streak.
scholarhat
7
abdefgabef
6