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

Longest Substring Without Repeating Characters

Omnissa logoOmnissa● MediumONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamples

Problem statement

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

Function

lengthOfLongestSubstring(s: String) → int

Examples

Example 1

s = "abcabcbb"return = 3

The longest substrings without repeated characters include "abc", with length 3.

Example 2

s = "bbbbb"return = 1

Every valid substring without repeats has length 1.

More Omnissa Onsite Interview questions

  • Build and Check a Palindrome Linked ListONSITE INTERVIEW · Seen Sep 2026
  • Find the CelebrityONSITE INTERVIEW · Seen Sep 2026
  • Maximum All-Ones Square Side LengthONSITE INTERVIEW · Seen Sep 2026
  • Maximum Subarray SumONSITE INTERVIEW · Seen Sep 2026
  • Coin ChangeONSITE INTERVIEW · Seen Jul 2026
  • Rotate Array RightONSITE INTERVIEW · Seen Jul 2026

Similar questions at other companies

  • Longest Substring Without Repeating CharactersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Longest Substring Without Repeating CharactersMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Shortest Deletion for Distinct CharactersOracle · ONSITE INTERVIEWOracle interview questions
  • Longest Substring Without Repeating CharactersGoogle · ONSITE INTERVIEWGoogle interview questions
  • Longest Substring Without Repeating CharactersAmazon · ONSITE INTERVIEW
  • Longest Substring Without Repeating CharactersInfosys · ONSITE INTERVIEWInfosys interview questions
  • Longest Substring with At Most K Distinct CharactersGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Longest Substring Without Repeating CharactersBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Sliding-Window Rate LimiterStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Longest Substring Without Repeated CharactersDatadog · ONSITE INTERVIEWDatadog interview questions
All Omnissa interview questionsSee Omnissa hiring insights
Saved
class Solution {
    public int lengthOfLongestSubstring(String s) {
      // write your code here
    }
}
Checking account…