Bloomberg Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Count islands and implement BFS variant
Given a 2D grid of characters '1' (land) and '0' (water), count the number of distinct land regions where connectivity is four-directional (up, down, ...
Find maximum cable length by cutting
You are given N cables with integer lengths and a target K. Cut the cables into pieces of equal integer length L to produce at least K pieces; maximiz...
Group words into anagram lists
Given an array of strings, group the words into lists of anagrams and return the collection of groups in any order. For example, ["abc", "cab", "edf"]...
Solve string dictionary and tree ordering
Part A — One-edit dictionary: Build a data structure supporting build(words: List[str]) and search(query: str) -> bool that returns true if and only i...
Design variable-size LRU cache
Implement an in-memory cache with least-recently-used eviction where each entry has a variable size in bytes. The cache exposes set(key, value, size),...
Find root from child adjacency lists
You're given an unordered list describing a rooted n-ary tree. Each item is a record of the form {id: int, children: set<int>} listing a node's direct...
Count subarrays with product under target
Given an array of positive integers nums and an integer T > 1, return the number of contiguous subarrays whose product is strictly less than T. Provid...
Check near-palindrome with one deletion
Given a string s, determine if it can become a palindrome after deleting at most one character. Return true or false and provide time and space comple...
Implement classes within an abstract Python framework
You are given an existing Python codebase (~200 lines shown) that defines an abstract base class DataProcessor with abstract methods load(self), trans...
Solve Magic Dictionary and unknown traversal
Question LeetCode 676. Implement Magic Dictionary Determine and implement traversal/encoding that outputs nodes as 'cia' for the given skewed binary t...
Solve Number of Islands
Question LeetCode 200. Number of Islands – Given a 2D grid of '1's (land) and '0's (water), count the number of islands. Follow-up: implement the solu...
Implement island counting with BFS and DFS
Given an m x n grid of characters where '1' represents land and '0' represents water, count how many connected land regions exist. Two cells are conne...
Implement classes in existing abstract hierarchy
You are given an existing Python codebase that defines multiple classes, including abstract base classes using abc.ABC and @abstractmethod decorators....