This is a classic puzzle which can look simple.
Given 25 horses, find the best 3 horses with minimum number of races. Each race can have only 5 horses. You don't have a timer.
Now the challange is how we can do it in 7 races.
Solution
We will have 5 races with all 25 horses
Let the results be
a1,a2,a3,a4,a5
b1,b2,b3,b4,b5
c1,c2,c3,c4,c5
d1,d2,d3,d4,d5
e1,e2,e3,e4,e5
Where a1 faster than a2 , a2 faster than a3 etc and
We need to consider only the following set of horses
a1,a2,a3,
b1,b2,b3,
c1,c2,c3,
d1,d2,d3,
e1,e2,e3,
Race 6
We race a1,b1,c1,d1 abd e1
Let speed(a1)>speed(b1)>speed(c1)>speed(d1)>speed(e1)
We get a1 as the fastest horse
We can ignore d1,d2,d3,e1,e2 and e3
a2,a3,
b1,b2,b3,
c1,c2,c3,
Race 7
Race a2,a3,b1,b2 and c1
The first and second will be second and third of the whole set
Showing posts with label Infosys Interview Puzzle. Show all posts
Showing posts with label Infosys Interview Puzzle. Show all posts
Thursday, November 3, 2011
Friday, May 2, 2008
Door Toggling Puzzle Or 100 Doors Puzzle
This is a very common interview puzzle. The problem is very simple if you understand it. So the point to note is, do not arrive at the solution so "fast”, if you are asked this puzzle in an interview and if you are not planning to show any acquaintance with this puzzle.
Problem goes like this :
There are N doors in a row numbered from 1 to N. Initially all are closed.
Then you make N passes by the N doors. In pass 1 you toggle the all the doors (1,2,3,4....)starting from the first door. In the second pass you toggle every second door(2,4,6,8,...). In the third pass you toggle all third doors(3,6,9...).Similarly you make N passes.
Question is what is the state of door k after N passes.
This is a simple but requires clear mathematical Logic.
Normally asked version has N=100.
Problem goes like this :
There are N doors in a row numbered from 1 to N. Initially all are closed.
Then you make N passes by the N doors. In pass 1 you toggle the all the doors (1,2,3,4....)starting from the first door. In the second pass you toggle every second door(2,4,6,8,...). In the third pass you toggle all third doors(3,6,9...).Similarly you make N passes.
Question is what is the state of door k after N passes.
This is a simple but requires clear mathematical Logic.
Normally asked version has N=100.
Subscribe to:
Posts (Atom)