~/DHRUVUpskilling
← board/DSA/Sliding Window/DSA-05
Solving·22 Aug

Longest Substring without Repeating Characters

DifficultyMedium
PatternSliding Window
TrackDSA
tl;dr

Given a string, str, return the length of the longest substring without repeating characters.

full write-up

Sample Example 1

Input:

  • string = "bbbbbb"

Output: length = 1

Sample Example 2

Input:

  • string = "pwwkew"

Output: length = 3

Sample Example 3

Input:

  • string = ""

Output: length = 0

Explanation: Empty string passed as an input.