Update appNew update is available. Click here to update.
Topics

Longest Substring Without Repeating Characters

Moderate
0/80
Average time to solve is 30m
profile
Contributed by
92 upvotes
Wells FargoSAP LabsExpedia Group
+37 more companies

Problem statement

Given a string input of length n, find the length of the longest substring without repeating characters i.e return a substring that does not have any repeating characters.

Substring is the continuous sub-part of the string formed by removing zero or more characters from both ends.

Detailed explanation ( Input/output format, Notes, Images )
Constraints:
 1<= n <=10^5

Time Limit: 1 sec
Sample Input 1:
 abcabcbb 
Sample Output1:
 3
Explanation For Sample Input 1:
Substring "abc" has no repeating character with the length of 3.
Sample Input 2:
 aaaa
Sample Output 2:
1
Full screen
Console