O19

Longest Substring Without Repeating Characters

Mid / Senior Engineer
Target Time: 25 - 35 Minutes
Type: NUMERIC

Problem Statement & Objective

Given a string s, find the length of the longest substring without repeating characters.

Function Signature (Python)

length_of_longest_substring(s: str) -> int

Input & Output Contract

Output Rule:Length integer of the longest non-repeating substring.

System Constraints

0 <= s.length <= 5 * 10^4
s consists of English letters, digits, symbols and spaces

Example Execution Walkthrough

s = "abcabcbb"
longest substring is "abc" -> length 3
s = "bbbbb"
result: 1

Example Test Scenarios (3)

Example 1
Input:["abcabcbb"]
Expected Output:3
Example 2: Tekrar
Input:["bbbbb"]
Expected Output:1
Example 3: 'wke'
Input:["pwwkew"]
Expected Output:3
Loading Python Editor...
Input Parameters
[
  "abcabcbb"
]
Expected Output
3