IP Prefix Store
Updated
Problem statement
Addresses are binary strings of exactly width bits. Each string in prefixes covers every address starting with it. Add all prefixes, then for each full-width query return lowercase true or false for whether any stored prefix covers it.
Append one final decimal string equal to the number of distinct full-width addresses covered by the union of all prefixes.
Function
runIpPrefixStore(prefixes: String[], queries: String[], width: int) → String[]Examples
Example 1
prefixes = ["1111","11"]queries = ["1100","1010","1111"]width = 4return = ["true","false","true","4"]Prefix 11 covers 1100,1101,1110,1111; adding 1111 does not double count.
Constraints
1 <= width <= 60.- Prefixes contain only 0/1 and have length at most width.
- Queries have length exactly width.
More Bloomberg LP Onsite Interview questions
- 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
- Word SearchOA · PHONE 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
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Design Search Autocomplete SystemRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Hybrid Run-Length and Bit-Packing EncoderDatabricks · ONSITE INTERVIEWDatabricks interview questions
- Word Dictionary with Wildcard FindAmazon · ONSITE INTERVIEW
- Implement a TrieMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Add Word and Suffix SearchAnduril · ONSITE INTERVIEWAnduril interview questions
- Trie: Add and Search WordsAdobe · ONSITE INTERVIEWAdobe interview questions
- In-Memory Directory and File OperationsSquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions
- File System PathsCapital One · ONSITE INTERVIEWCapital One interview questions
- Trie With Insert, Search and Prefix CheckExpedia · ONSITE INTERVIEWExpedia interview questions
- Design File SystemGoogle · PHONE SCREENGoogle interview questions
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)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)