Microsoft Interview Question for SDE-2s

Country: United States
Interview Type: In-Person

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

This question is a little complicate, isn't? Someone has some idea?

- tiandiao123 August 30, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

What does K the torch represent? What does 'maximum of x people time' mean? Is it the maximum time a person in group takes?

But it seems like what we want to do is minimize the time required for all people to cross the bridge. If we let T = [a1,a2,...,an], we can sort T in descending order. Since x number of people can cross the bridge at a time, we can simply group T into T/x groups and move each group one at a time. To make it more clear, take the following instance:

N = 7 #number of people
T = [1,2,3,1,2,5,4] #time each person takes to cross
x = 3; #number of people that can pass per round

- sort T: [5,4,3,2,2,1,1]
- group T into T/x groups
  - group1: [5,4,3]
  - group2: [2,2,1]
  - group3: [1]

- Now group1 crosses bridge, it takes Max([5,4,3]) = 5
- Now group2 crosses bridge, it takes Max([2,2,1]) = 2
- Now group3 crosses bridge, it takes Max([1]) = 1
- Total time: 5 + 2 + 1 = 7

The above is just a greed approach. But I maybe misinterpreting the question, @neer any more details or comments?

- tnutty2k8 August 31, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

Problem is generalization of Torch and Bridge puzzle. Try google it.

- neer.1304 August 31, 2017 | Flag Reply

Add a Comment

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


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


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