Bloomberg LP Interview Question for Senior Software Development Engineers


Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
2
of 2 vote

1) Since the size of the Window is not relevant nor is the TimeStamp, this would break down to checking for the occurrence of an ip address that is more than an arbitrary k value.
2) For a stream or a static file:
a. HashMap<Ip, Frequency>
b. Increment each ip as they occur
c. Keep a counter with (value = k) and check (while inserting a value) that if it crosses K.
d. Return that IP and break.

Please let me know if my thinking is correct.

- wolfengineer February 25, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I assume both timestamps and ip address are represented in string.
All you need to do is create a Hash Table.

Map<String,List<String>> map=new HashMap<();
for data in stream
	if(!map.containsKey(ip))
		map.put(ip, new ArrayList<String>(Arrays.asList(timestamp)));
	else map.get(ip).add(timestamp);

List<String> result=new ArrayList();
for key in map.keySet()
	if(map.get(key).size()>=k) 
		result.add(key);

return result;

- hcallen.wang February 29, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I assume the time window will be specified. My approach: use a double edge queue to keep timestamp/IP pairs within T and a hash map of IP/counter to count the IP address occurrences. For every new entry coming from file or stream, decrement the count of deque's front's IP in the hash map and pop it from deque's front. Then keep adding new entries while incrementing their counters in a loop until we exceed current_time+T. Check against K and print the offender when updating hash map. Then repeat.

- Michael Kovalenko May 16, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I assume the window size T is expected. This is about the frequency of a string within a variable size sliding window. A combination of double edge queue (to store timestamp/IP) and a hash map (key=IP, value=count) will do. And a couple of loops.

- mike800 May 16, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

why should use deque? why not just normal (priority by time)queue?

- hmm July 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Why should use deque??? why not normal priority queue by timestamp?

- hmm July 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

IS YOUR CAPS LOCK LOCKED?

- Anonymous August 05, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More