Anurag Poddar must be new here...
No ratings yet!
All the King's Wine
How is this for a solution? Number bottles as 000,001,002,....998,999 and the servants as 0,1,2,...8,9. On day 0: i th servant drinks from bottles with hunderedth place as i On day 1: i th servant drinks from bottles with tenth place as i On day 2: i th servant drinks from bottles with ones place as i Problem with this algo: In case the 545th bottle was posioned, we won't be able to determine whether it was 545 or 544. (hence 998 bottles will be available in 36% cases, else 999 bottles) It is given "about 3 weeks". If it were exactly 3 weeks, then there would be no problem. Advantage: Atmost 3 servants die. (average of 2.71) while in Binary way: At most 9 servants die. (average of ~5) context |
All the King's Wine
BTW, you do not need binary or complicated stuff as given in the official answer. context |
All the King's Wine
Hundreds, tens, ones. (reminds me of Kindergarten) context |
No if() Only abs()
max(a,b) = ((a+b)+|a-b|)/2 context |