Tries & Prefix Search
Segmentation is the exception to Bloomberg's light dynamic programming, and the yes-or-no version is rarely the end of it. One form wants the sentence rebuilt with spaces. The harder one wants every sentence the string can become. The prefix tree is here because both problems work over a dictionary. Bloomberg asks typeahead as a system design, and it also asks for the trie itself in code, as prefix completion over a list of words. A hash set only tells you whether one exact string is a word. A trie tells you which words begin at a given point, in one pass down the tree, and that speeds up the segmentation too. Get the memoised or tabulated segmentation passing first. A working memo with time left beats a half-built trie when the clock runs out. While you fill the table, record which word you took at each position, so rebuilding the sentence is one walk from the front.
BloombergPremium lesson · Coding round
The 3 Bloomberg problems are below.
- A Premium questionCoding · Medium
- A Premium questionCoding · Medium
- A Premium questionCoding · Hard
Each with hints, the follow-up and a tested solution.
Get the Bloomberg questions$49 a year · all 100 companies · cancel anytime
From 330 Bloomberg reports, forum threads behind logins and write-ups in Chinese.
Bloomberg interview guideKnow what Bloomberg asks before you walk in.
27 coding · 4 system design · 15 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.