• Last Updated : 17 Jan, 2014

Question 1
There are 25 horses among which you need to find out the fastest 3 horses. You can conduct race among at most 5 to find out their relative speed. At no point you can find out the actual speed of the horse in a race. Find out how many races are required to get the top 3 horses.
Discuss it

Question 1 Explanation: 
The minimum no of races to be held is 7. Make group of 5 horses and run 5 races. Suppose five groups are a,b,c,d,e and next alphabet is its individual rank in tis group(of 5 horses).for eg. d3 means horse in group d and has rank 3rd in his group. [ 5 RACES DONE ] a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 a5 b5 c5 d5 e5 Now make a race of (a1,b1,c1,d1,e1).[RACE 6 DONE] suppose result is a1>b1>c1>d1>e1 which implies a1 must be FIRST. b1 and c1 MAY BE(but not must be) 2nd and 3rd. FOR II position,horse will be either b1 or a2 (we have to fine top 3 horse therefore we choose horses b1,b2,a2,a3,c1 do racing among them [RACE 7 DONE].the only possibilities are : c1 may be third b1 may be second or third b2 may be third a2 may be second or third a3 may be third The final result will give ANSWER. suppoose result is a2>a3>b1>c1>b2 then answer is a1,a2,a3,b1,c1. HENCE ANSWER is 7 RACES Source: http://www.geeksforgeeks.org/adobe-interview-set-4/
There is 1 question to complete.
My Personal Notes arrow_drop_up

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.