FastPrepAll Longest Substrings Without Repeating Characters
Problems/All Longest Substrings Without Repeating Characters

All Longest Substrings Without Repeating Characters

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bloomberg new grad phone screen. The report names the well-known Longest Substring Without Repeating Characters problem, number 3. It also records a follow-up that asks for every substring of the maximum length. The approach was to keep the left and right ends in a set and build the substrings afterward. Here you return the substrings from left to right, and the same text from different positions counts each time.

Given a string s, return every occurrence of a longest substring with no repeated character. A substring is a run of characters that sit next to each other in s.

List the occurrences from left to right. If the same text appears at several longest positions, include it once for each position. If s is empty, return an empty array.

Function

allLongestUniqueSubstrings(s: String) → String[]

Examples

Example 1

s = "abcabcbb"return = ["abc","bca","cab","abc"]

The longest length with no repeat is three. Four substrings reach it, and the text abc appears at two positions, so it is listed twice.

Example 2

s = "bbbbb"return = ["b","b","b","b","b"]

Every substring longer than one character repeats b, so each single character is returned, once per position.

Example 3

s = ""return = []

The string is empty, so the answer is an empty array.

Constraints

  • 0 <= s.length <= 100000.
  • s contains ASCII English letters, digits, spaces, and common symbols.
  • Each returned string is copied exactly from s, character for character.

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Longest Substring Without Repeating CharactersAngel One · PHONE SCREEN
  • 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

Interview reports that mention this question

  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
  • Bloomberg New Grad Screens: 30 Experiences (Part 4 of 5)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public String[] allLongestUniqueSubstrings(String s) {
        // Write your code here.
    }

}
Checking account…