medium
Longest Substring Without Repeating Characters
Given a string, find the length of the longest contiguous substring in which no character occurs twice.
Constraints
- 0 ≤ s.length ≤ 5 · 10^4
- s consists of printable ASCII characters
Examples
in: s = "abcabcbb"
out: 3
"abc" is the longest run with distinct characters.
in: s = "bbbbb"
out: 1
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.