If you are interviewing at bloomberg for a software engineering internship or new grad role, this might really help you.
I recently gave an interview for New grad postion and while preparing I maintained my a list of all the questions that have been previously asked by bloomberg. The following link contains almost all of the interview questions that have beeen asked in bloomberg in the last 2 years and what kind of follow ups they ask.
Link - (removed notion link as I have deleted the page)
Always code optimally!!
Bloomberg interviews mostly include medium questions from Leetcode. The main topics and questions they ask are listed below. In order to start preparing for the interview, the first thing you should understand their interview pattern, and devise a preparation plan.
Array of currency conversion rates. E.g. ['USD', 'GBP', 0.77] which means 1 US is equal to 0.77 GBP an array containing a 'from' currency and a 'to' currency. Given the above parameters, find the conversion rate that maps to the 'from' currency to the 'to' currency. Your return value should be a number
// Example:
You are given the following parameters:
Rates: ['USD', 'JPY', 110] ['US', 'AUD', 1.45] ['JPY', 'GBP', 0.0070]
To/From currency: ['GBP', 'AUD']
Output: 1.89Design a data strucutre with the following interfaces to find the first unique number in a datastream.
public class Stream {
public Stream() {
// do intialization if necessary
}
/**
* Adds integer num to a stream of integers.
*/
public void add(int num) {
// write your code here
}
/**
* Returns the first unique integer in the stream if found else return null.
*/
public Integer getFirstUnique() {
// write your code here
}
}Implement the following two functions such that they are optimal. addStocksVolume receives a symbol (INTC, APPL, etc) plus a volume which you cumulate over time. topKstocks would return the k stocks with the highest volume.
void addStocksVolume(string stockSymbol, int volume) {
}
vector<string> topKstocks(int k) {
// return k top stocks
}Given a list of operation hour for each stock exchange, validate if the customer can send a trading order during the input hour. The interviewee asked me(the author) to list all possible solutions that I got and explain the time and space complexity of each solution. Also, he asked me to describe the advantages and disadvantages of each one.
// Example
Operation hours
09:00-16:00 Royal Bank of Scotland
11:00-17:00 Morgan Stanley
Test case #1 - expected result: SUCCESS
10:00-17:00
Test case #2 - expected result: FAILURE
15:00-21:00Given two arrays, return the intersection of two lists. (both cases - when sorted and when not)
// Example
A = [1, 2, 3, 4]
B = [2, 4, 6]
Result - [2, 4]Given List and a function (take 2 params, returns if 2 are of same group) - return list of lists that belong to same group.
bool sameGroup(int a, int b) {
// returns true if the elements are of same group else false.
}Return the strings having characters that are not present in another string
// example
string a - "abcd"
string b - "ab"
ans - "cd"Similar - Break a long list into 2 smaller lists, 1st smaller list has all elements that are smaller than the elements in 2nd list.
find string at highest depth.
//example
input: "((AB)(((CD))))"
output: depth: 4 and string: "CD"Given an array return whether the array is sorted or not (boolean).
true -> Ascending or Descendingtrue -> if all are sametrue -> if just one elementfalseSort tree by its childrens and return root, here N=total no of nodes and m is avg no of children
// Example
World
/ | \\
/ | \\
C A B
/ | | /|\\
/ | | / | \\
E D F H G I
to
World
/ | \\
/ | \\
A B C
| /|\\ |\\
| / | \\ | \\
F G H I D EGiven an array sorted by its absolute values, return sorted array by it actually values - Solve in O(N)
// example
input: 0,-1, 2, -4,5, 6, -10, -13, -22
output: -22, -13, -10, -4, -1,0, 2, 5, 6Given 2d matrix, find maximum path sum in given N steps only
// example
2, 3, 4, 6
1, 2, 3 ,5
3, 4, x ,5
0, 1, 2, 3
N = 2
starting cordinate = (2,2)
N = 2
Output: 10 (5->5)A TV show is "addictive" if the viewers quickly become addicted to the show and eventually finish watching the show. It can be tracked after viewing how many episodes of a show at least 70% of the viewers who watched that continued on to finish the show entirely. In other words, more that 70% of the viewers who watched the first x eposides of a show continued on to finish the entire show. The x is what we are looking for.
Assumptions:
Given a log of entries consisting of a user id, the show name and the episode number that was watched, produce the x for each show.
// example
Input: The following function is called for each log entry
void process_log(string show, int episode, int user_id)
Expected Output:
void print_results();Remove ints from an array from given ranges.
Example:
Input: array = [-8, 3, -5, 1, 51, 56, 0, -5, 29, 43, 78, 75, 32, 76, 73, 76],
ranges = [[5, 8], [10, 13], [3, 6], [20, 25]]
Output: [-8, 3, -5, 29, 43, 76, 73, 76]Consider a vector of employees with a name and their title: <John, Manager>. And a dictionary where the keys report to the values: [CTO, CEO]. Re-order the vector of employees according to the dictionary mappings. The vector of employees can be extremely big, however the dictionary only contains the title orderings.
vector : [<John, Manager>, <Sally, CTO>, <Sam, CEO>, <Drax, Engineer>, <Bob, CFO>, <Daniel, Engineer>]
dict: {[CTO, CEO], [Manager, CTO], [Engineer, Manager], [CFO, CEO]}
output:
[<Drax, Engineer>, <Daniel, Engineer>, <John, Manager>, <Sally, CTO>, <Bob, CFO>, <Sam, CEO>]
Genereate Number with two operations in min steps. Given an int n. You can use only 2 operations:
Find the minimum number of steps required to generate n from 1.
// Example
Input: 10
Output: 6
Explanation: 1 * 2 * 2 * 2 * 2 / 3 * 2
6 steps required, as we have used 5 multiplications by 2, and one division by 3.
You work in an electronic exchange. Throughout the day, you receive ticks (trading data) which consists of product name and its traded volume of stocks. Eg: {name: vodafone, volume: 20}. What data structure will you maintain if:
There is a continous stream of data in the form of (1, "abcd"). Write a program to output the data from the stream in realtime in order, so 1,2,3,4,5. You cannot queue up the incoming data from the stream.
Input: (1, "abcd"), (2, "efgh"), (4, "mnop"), (5, "qrst"), (3, "ijkl")
So for example if the first incoming bit of data is (1, "abcd"), and the second is (4, "mnop"), you cannot output (4, "mnop") until you get 2, 3.Please feel free to Copy/Add/update anything. or If you know any questions that are not on the list and have been asked in Bloomberg, please comment so that i can update it.