Bloomberg LP Interview Question for SDE1s


Country: United States
Interview Type: In-Person




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

Objects
--------

Person {
int name;
int id
}

CheckPoint {
	DoublyLinkedList first;
	DoublyLinkedList last;
	Map<String, DoublyLinkedList> personToDLL; // person id to node
	public CheckPoint() {
		personToDLL = new HashMap<>();
	}
}

DoublyLinkedList {
	Person person;
	DoublyLinkedList prev;
	DoublyLinkedList next;
}

Variables
-----------

Map<String, CheckPoint> map; // checkPoint name to Object map
String HighestCheckPointReported; // to store the highest checkPoint that is reported;

Logic :

Everytime a person crosses the checkPoint(CP2)
1. Go to previous check point(CP1) if exists, get the node and delete from the list and map;
update the first and last node in checkPoint accordingly;
add the node to the current checkPoint based on the last node;
add to the map as well;

else
if previous check point doesnt exists, create the person the insert into the list; add this to the map; in current checkPoint

finally
Everytime update the HighestCheckPointReported if it is higher


To get the rank

Iterate from the HighestCheckPointReported to the lowestCheckPoint[first node in each CheckPoint object would help to find the order]

- sriram.itech October 11, 2018 | 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