Length of the longest substring
Medium Acceptance 50.00% Points 30.00
Given a string s, find the length of the longest substring without repeating characters.
Examples
Example 1
Example 1
Input: s = "geeksforgeeks"
Output: 7
Explanation: Longest substring is "eksforg".
Example 2
Example 2
Input: s = "abdefgabef"
Output: 6
Explanation: Longest substring are "abdefg" , "bdefga" and "defgab".
Example 3
Example 3
Input: s = "aaaaa"
Output: 1
Explanation: Longest substring is "a".
Constraints
- 1 = s.size() = 10^5
- It is guaranteed that all characters of the String s will be lowercase letters from 'a' to 'z'
Companies
Amazon Microsoft Google Morgan Stanly
Track your submissions
Please log in to review your progress and explore code submissions from other participants.
Unlock the full solution
Please log in to access detailed answers and explanations.
Join the discussion
Please log in to join conversations with other participants.