FastPrepStreaming Palindrome Checker
Problems/Streaming Palindrome Checker

Streaming Palindrome Checker

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for track(char) and isPalindrome() on an append-only character stream that could be as big as a terabyte, with palindrome queries faster than O(n). Our version has a finite input and returns the results of all the queries. An empty stream counts as a palindrome. Characters are lowercase English letters. Answers must be exact, so rolling hashes that can collide are not allowed.

Process an append-only stream of lowercase characters. The stream starts empty, and each row of operations is one of:

  • ["track", character]: append the one-character string character to the stream.
  • ["isPalindrome"]: report whether the entire stream currently reads the same forward and backward.

Return the boolean answers to the isPalindrome operations in encounter order. The empty stream is a palindrome.

Each isPalindrome query must run in O(1) time. The complete operation sequence must be processed exactly, without probabilistic hashing.

Function

streamPalindrome(operations: String[][]) → boolean[]

Examples

Example 1

operations = [["track","a"],["track","b"],["track","c"],["track","b"],["track","a"],["isPalindrome"]]return = [true]

The tracked stream is abcba, which is a palindrome.

Example 2

operations = [["isPalindrome"],["track","a"],["isPalindrome"],["track","b"],["isPalindrome"],["track","a"],["isPalindrome"]]return = [true,true,false,true]

The queried streams are empty, a, ab, and aba.

Example 3

operations = [["track","a"],["track","b"],["track","b"],["isPalindrome"],["track","a"],["isPalindrome"],["track","c"],["isPalindrome"]]return = [false,true,false]

The queried streams are abb, abba, and abbac.

Constraints

  • 1 <= operations.length <= 200000.
  • Every row is exactly ["track", character] or ["isPalindrome"].
  • Every tracked character is one lowercase English letter.
  • At least one isPalindrome operation occurs.

More Bloomberg LP Onsite Interview 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
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Recover a Tree From Preorder TraversalGrammarly · PHONE SCREEN · ONSITE INTERVIEW
  • Parse Boolean Rule ExpressionsStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Highlight and Rank Overlapping CitationsHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions
  • Serialize and Deserialize a Binary TreeAmazon · ONSITE INTERVIEW
  • Minimum Insertion Steps to Make a String PalindromeInfosys · ONSITE INTERVIEWInfosys interview questions
  • Wildcard MatchingTripjack · ONSITE INTERVIEWTripjack interview questions
  • Alien DictionaryByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • All Balanced Strings from Minimum Parenthesis InsertionsRubrik · ONSITE INTERVIEWRubrik interview questions
  • Design Search Autocomplete SystemRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Longest Duplicate SubstringGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions

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 New Grad SWE Interviews: 98 Experiences (Part 1 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
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public boolean[] streamPalindrome(String[][] operations) {
        // Write your code here.
    }

}
Checking account…