## Bloomberg LP Interview Questions

- 0of 0 votes
Image an airport with the control tower having a constantly rotating radar scanning for airplanes. The radar's coordinates in the 2-d plane are (0,0). The radar has an API: void scan(const Plane &P) that is called periodically whenever the radar detects a plane. You can imagine that the Plane structure has x,y coordinates for that plane. You should fill in the function Scan, such that at any given time you are able to return the 100 closest planes to the tower (0,0).

- 0of 0 votes
Find summation of n records added in past 60 secs

Items of the type`struct { int i; time_t timestamp; }`

needs to be stored in a C++ container. One of the requirement is to calculate summation of 'i' s of these items added in past 60secs.

What container/datastructure will you use. (number of items can be in the order of 10s of thousands.

- 1of 3 votes
Given an array A = [3, 7, 2,5,6,4] for a number N, print the pairs from that array A that sums up to N. You should print each pair once.

- 0of 0 votes
Given an array A [0, 1, 3, 4,9,5,7,6] and number N.

This means that the array consists of the numbers from 0 ... N. However, as you see, 8 is missing in A. Print the missing number.

Think about the case N = 10^6

- 0of 0 votes
How do you decide whether we should use Java or C++ for a particular project . what are pros and cons

- 0of 0 votes
How does garbage collector work ? In mark and sweep , how does gc know which objects it needs to mark , how are references stored for objects for gc to understand that its reference is null or it is no more referenced anywhere j

- 0of 0 votes
Implement hashtable put function in C++ without using STL stuff.

- 0of 0 votes
A client wants to build a software phone book that contains everyone in the world (7 billion people). Every person has only the first name and the name is unique. What data structure would you use to store the data?

- 0of 0 votes
Given a MxN grid, like :

`111 111 111 or 001 111 001`

Write a function to return all possible paths from start (0,0) to destination (M-1,N-1). Allowed moves: right, down, and diagonal down. Value 1 indicates moves is possible, 0 indicates move not possible.

- 0of 0 votes
Given a BST write a function that looks for a value.

- 2of 2 votes
There's a function that concatenates two strings and returns the length of the resultant string. When called upon a series of strings how do we minimize the cost of using this function. Let's say we have 3 strings, A= "abc", B="def", C = "gh".

Now cost of merging AB = 6 and cost of merging the resultant string with C is 8. Thus the total cost is 6 + 8 = 14. However, if we merge A and C, then the cost is 5 and then merge B with this, the cost is 8, so the total cost is 13.

Find an algorithm that minimizes the cost of adding such a series of strings.

- 0of 0 votes
You have a function f1() that generates 0 or 1 with the equal probability. Write a function f29() that generates a number between 0 and 29 with equal probability.

- 0of 0 votes
Make use of an example to depict Singleton pattern. How would you make sure it works in Multithreaded environment.

- 0of 0 votes
What's the use of concurrency list in java? What are various locking mechanism in java?

- -1of 1 vote
Write code for reader writer (multi threading)

- -1of 1 vote
How would you instantiate/start/stop thread in java.

- -1of 1 vote
Explain diff between thread vs process.

- -1of 1 vote
I think Bloomberg heavily expects candidates to have good knowledge of Multithreading concepts as they work in financial data.

Explain multithreading.

- 0of 0 votes
Write a method that takes the root of a tree as input and check if the tree is a Binary Search Tree (BST).

- 0of 0 votes
Given a sorted array of integers, using the same array, shuffle the integers to have unique elements and return the index.

Sample input : [3, 3, 4, 5, 5, 6, 7, 7, 7]

Sample output : [3, 4, 5, 6, 7, X, X, X, X]

In this case, it returns an index of 4.

The elements in the array after that index is negligible (don't care what value it is).

- 0of 0 votes
In C++, what's the difference between public and private? what's the purpose of this and please illustrate a design example with this.

- 0of 0 votes
Write a maxDepth function to find maximum depth of a binary tree. What is the time and space complexity of your function.

Given:`class Tree { public Tree left; public Tree right; } int maxDepth(Tree head) {}`

- 1of 1 vote
You are given an organization hierarchy tree (n-ary tree). Every employee (node) has some value (can be -ve or +ve). You have to host a party and have to invite employees such that the total value (summation of each node value) of all the employees is maximum.

there is a rule: no one likes to see their bosses in the party. So you cant invite an employee's immediate boss or subordinate.

You can skip more than 1 level if it gives you maximum value.

- 0of 0 votes
Good day I just got a question which is the following

you have an vector like this

[JFK, LXA, SNA, RKJ, LXA, SNA]

each 2 group define a route. so,

JFK -> LXA

SNA -> RKJ

LXA -> SNA

Find the path from departure to destination. note: departure and destination are not known.

The final destination should be

JFK-> LXA -> SNA -> RKJ

The function signature is something like this

vector<string> findPath(vector<string> airports)

{

}

The airports (nodes) cannot be duplicated and the path should print all the airports (nodes)

- 0of 0 votes
Good day I just got a question which is the following

you have an vector like this

[JFK, LXA, SNA, RKJ, LXA, SNA]

each 2 group define a route. so,

JFK -> LXA

SNA -> RKJ

LXA -> SNA

Find the path from departure to destination. note: departure and destination are not known.

The final destination should be

JFK-> LXA -> SNA -> RKJ

The function signature is something like this

vector<string> findPath(vector<string> airports)

{

}

The needed the full path from departure to destination, and you can only pass by one point only once.

Thanks!

- 0of 0 votes
Implement strcmp function of stdlib.h library without using any standard library.

- 0of 0 votes
Implement a Singleton class in java? How will this help?

- 0of 0 votes
Suppose that there is a database table, and four processes read the table at the same time. But, only one process is allowed to read the same row of the table at the same time. How do you enforce the exclusive-read on a row?

- 0of 0 votes
What is Encapsulation? What is inheritance? When and Why should you use the inheritance?

- 0of 0 votes
What is the Abstract class? What is the difference between an abstract class and an interface? When should you use an abstract class instead of interface?