Free beta: free to use with daily limits while we build. Join the waitlist for founding-member pricing at launch. Join the waitlist

Sign up free

Quora interview question

Length of the longest substring without repeating characters

Company:
Quora
Type:
Coding
Difficulty:
Medium
Reported:
June 2, 2026

Problem

Given a string s, return the length of the longest contiguous substring that contains no repeated character.

The interviewer also cares about communication: explain the idea clearly with a short dry run before coding, so the approach is understood quickly.

Example 1

Input: s = "abcabcbb"
Output: 3

"abc" is the longest substring without a repeated character.

Example 2

Input: s = "pwwkew"
Output: 3

"wke" has length 3; "pwke" is not contiguous.

Constraints

  • 0 <= len(s) <= 5 * 10^4
  • s may contain letters, digits, symbols and spaces.

Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern