Medium36.8% acceptance

Longest Substring Without Repeating Characters

Find the length of the longest substring containing no repeated characters.

Topics

Sliding WindowHashing

Examples

Input: s = "abcabcbb"
Output: 3
Input: s = "bbbbb"
Output: 1

Expected Complexity

O(n) time and O(k) space using a sliding window.

What happens after Submit?

ERROR DNA analyzes your submission and identifies recurring patterns in your mistakes.

solution.cppC++17
Loading...
C++17