Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Longest Substring Without Repeating Characters

Medium
stringsliding-windowhash-table

Given a string s, return the length of the longest substring that contains no repeating characters.

Input: one line s. Output: the length as an integer.

Example 1
Input:
abcabcbb
Output:
3

"abc" has length 3.

Example 2
Input:
bbbbb
Output:
1

"b" has length 1.

Constraints

  • 0 ≤ s.length ≤ 5·10^4
  • s consists of English letters, digits, symbols, and spaces.
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.