FastPrepLongest Substring Without Repeating Characters
Problems/Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters

Angel One logoAngel One● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: In the first Angel One round, the second of two coding questions was Longest Substring Without Repeating Characters, named directly.

The report gives no examples, limits or changes to the usual task. Here you get the standard version: return the length of the longest run of neighboring characters with no character repeated. We added the string length and character limits.

Our version is about 90% the same as the reported question.

Given a string s, return the length of the longest substring of s in which no character appears more than once.

A substring is a run of neighboring characters, so the characters must be next to each other in s. Uppercase and lowercase letters are different characters, and a space is a character too.

Function

lengthOfLongestSubstring(s: String) → int

Examples

Example 1

s = "abcbdea"return = 5

The substring "cbdea", from index 2 to index 6, has 5 different characters. Any longer substring would include both bs or both as.

Example 2

s = "abba"return = 2

The longest substrings with no repeat are "ab" and "ba", each of length 2. The middle "bb" has a repeat, and so does the whole string.

Example 3

s = ""return = 0

The string is empty, so the longest substring has length 0.

Constraints

  • 0 <= s.length <= 5 * 10^4
  • s consists of English letters, digits, symbols and spaces (printable ASCII characters).

More Angel One Phone Screen questions

  • Subarray Product Less Than KPHONE SCREEN · Seen Nov 2026
  • Gas Station CircuitPHONE SCREEN · Seen Oct 2026
  • Longest Increasing SubsequencePHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Longest Substring Without Repeating CharactersNykaa · PHONE SCREENNykaa interview questions
  • Longest Substring Without Repeating CharactersIBM · PHONE SCREENIBM interview questions
  • Longest Substring Without Repeating CharactersTikTok · PHONE SCREENTikTok interview questions
  • Find Word-Multiset WindowsAmazon · PHONE SCREEN
  • Find the First Contiguous HaikuFaire · PHONE SCREEN
  • Longest Substring Without Repeating CharactersCapgemini · PHONE SCREENCapgemini interview questions
  • Longest Substring Without Repeating CharactersWex · PHONE SCREEN
  • Minimum Window of Required WordsSalesforce · PHONE SCREENSalesforce interview questions
  • Longest Substring Without Repeating CharactersRedNote · PHONE SCREEN
  • Longest Substring Without Repeating CharactersNetflix · PHONE SCREENNetflix interview questions
See Angel One hiring insights
Saved
class Solution {
    public int lengthOfLongestSubstring(String s) {
        // Write your code here.
    }
}
Checking account…