Bloomberg Software Engineer Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Find invalid transactions in time-sorted input
Problem You are given a list of transaction records, already sorted in non-decreasing order by time. Each transaction is a string in the form: "name,t...
Implement a simplified grep with extensible flags
Problem Implement a simplified version of grep that searches a text file and returns the lines that match a given query string. You should focus on cl...
Generate all strings by expanding wildcards
Problem Given a string s consisting only of characters '0', '1', and '', replace every '' with either '0' or '1' and return all possible resulting bin...
Count friend requests based on age rules
Problem You are given an array ages, where ages[i] is the age of the i-th person. A person of age A will send a friend request to a person of age B if...
Solve word path in grid and trapped water
You are given two independent programming tasks. --- Problem 1: Check if a word exists in a 2D character grid You are given a 2D grid board of charact...
Answer multi-round grid and data-structure questions
You are given several independent interview-style coding questions. 1) Find first/last occurrence in sorted array (+ dynamic updates follow-ups) Given...
Solve two array and string problems
You will solve two independent coding tasks. Problem 1: Generate All Subsets of a Set You are given an integer array nums containing n distinct elemen...
Implement anagram check and odd-even linked list
You are given two independent coding tasks. Task 1: Check if two strings are anagrams Implement a function that determines whether two given strings a...
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 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...
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),...
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...
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...
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...
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...
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 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...
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...
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....