Interview Question


Country: United States




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

Suppose there are four person named as a,b,c,d , which take 1,2,5,10 minutes to cross the bridge.
1)first 'A' and 'B' cross the bridge and 'A' will come back again at original side , it will take total of 3 minutes (2+1).
2) now 'C' and 'D' cross the bridge and 'B' will come back again at original side with flash light.it will take total of 12 minutes (10 + 2)
3) Finally 'A' and 'B' cross the bridge with flash light and no need to come back again at original side. because all four are at other side of bridge. this step will take 2 minute.

So total tike taken is 3 + 12+ 2 => 17 minutes.
Let me know if more clarity requires.

- Gupta June 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

k thanks dear...
i was missing that...

- shreyans June 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Lets say 4 persons A, B,C & D
A= 1 Min.
B= 2 min.
C= 5min,
D = 10 mins.

1. first A & B will go , A will return total time 1+2= 3 min.B will be stay there.
2. C & D will go together, B will return now. Total time D+B = 10 +2 = 12 Min.
3. Finally A& B will go together , total time 2 min.
So total time to cross bridge is 3+12+2 = 17 Min

- mahendra June 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

There is a general algorithm that can solve any combination and find the min time for crossing.

- anonymous June 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hey guys. Finding the solution to this specific problem is not a big deal, what is interesting here is the algorithm, especially when considering the number of people grows. Can you generalize and scale the algorithm - I think this is what actually the problem setter wants to see here. For example, how would yoou go with the series like: 1, 2, 5, 10, 12, 16, 20, 22, etc ?

- ashot madatyan June 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

There is no reason to extrapolate and assume that this is what the problem setter wants. The 17-minute puzzle is a classic problem.

- Anonymous June 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yeap, that's a classic problem, no doubt and no arguing there. What I wanted to communicate was what will you, as an interviewee, answer to the question posed by me - how would you generalize the solution and what is the reasoning behind it.

- ashot madatyan June 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

this is one of classic fuckiinnnng puzzle !!!

- Anonymous June 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

BAZINGA !!!

- Sheldon Cooper June 19, 2012 | Flag


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