Bloomberg L.P.
3.2 of 5
www.bloomberg.com New York, NY 5000+ Employees

# Bloomberg L.P.Financial Applications Engineer Interview Question

I interviewed in New York, NY and was asked:
"Some problems were quite difficult for this position. Maybe the interviewers didn't like me personally. Check if two linked list intersect, if so, find the intersection point. Travelling salesman problem."

Part of a Financial Applications Engineer Interview Review - one of 1,602 Bloomberg L.P. Interview Reviews

0
of 1
vote
I think the followings are pseudo enough......
---------------------------------------------------------------------------
a = length of ll1, b = length of ll2, c = abs(a-b);

do ->
;traverse (longerlist = a > b ? a : b) by c times
end do

do ->
;traverse (a AND b) in parallel node after node
;if the node at both a and b are the same address -> return this node
- Dekus on Sep 17, 2012 Flag Response
0
of 0
@Dekus What do you mean by traverse and in parallel? If you do it in parallel, (i++, j++ equivalent) you are making the assumption that the lists are aligned, and the intersection happens at the same place in both of them. Also, the first portion does not make sense. Consider the case wherethey are singly linked lists and two nodes point to 1.

My suggestion: traverse a list, and map (hashtable) the addresses of the next pointers to a boolean. <int32, bool> then go through the other list and check to see if any next pointers are in the hashtable. This would be time: O(N + M) and space: O(N)
- Mikhail on Oct 9, 2012 Flag Response

### Bloomberg L.P. – Why Work for Us?

Bloomberg’s global mission is to help individuals, enterprises and governments make smarter, faster, more profitable decisions — first. In order to get there, we need constant ideas, energy, innovation— which is where…

Provided by employer [?]

### Salaries by Company

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Bloomberg L.P. interview questions and advice. All interview reviews posted anonymously by Bloomberg L.P. employees and interview candidates.