# More Puzzles

 Very Easy Logic Problems You have 2 eggs.
 Mon Dec 26, 2016 6:20 am  by tartle You have 2 eggs. You are on a 100 floor building. You drop the egg from a particular floor. It breaks or survives. If it survives you can throw the same egg from a higher floor. How many attempts do you need to identify the max floor at which the egg doesn't break when thrown down? Tue Jan 24, 2017 3:56 pm  by Zelarith Assuming it takes a distance of 100 or fewer floors to break the egg. First draft : Basically, with your first egg, you'll try to find the lowest X for wich the egg will break when thrown from the (X * 10)th floor. Then you will use the second to try out each and every floor between the ((X-1) * 10)th and (X * 10)th floor until it breaks. Worst case scenario : floor 99 in 19 attempts. One thing I noticed in this draft is that, the different scenarios upon breaking the first egg are really unbalanced : if it breaks on the 10th floor, you'll need between 2 and 10 tries (1 + [1-9]), but if it breaks on the 100th floor, you already used 10 attempts and still have between 1 and 9 attempts left to find the answer. To balance things out, each time you throw your (first) egg, you should be clearing one less floor than what you did on your previous throw. The only thing left is to find out the starting value. The first value should be found by solving X + X-1 + X-2 + ... + 2 + 1 >= 100 (Skipping the math because I'm too rusty to do it properly) X = 14. So you'll throw the first egg until it breaks on floors : MAX(00 + 14 ; 100) = 14 (1 attempt) MAX(14 + 13 ; 100) = 27 (2 attempts) MAX(27 + 12 ; 100) = 39 (3 attempts) MAX(39 + 11 ; 100) = 50 (4 attempts) MAX(50 + 10 ; 100) = 60 (5 attempts) MAX(60 + 09 ; 100) = 69 (6 attempts) MAX(69 + 08 ; 100) = 77 (7 attempts) MAX(77 + 07 ; 100) = 84 (8 attempts) MAX(84 + 06 ; 100) = 90 (9 attempts) MAX(90 + 05 ; 100) = 95 (10 attempts) MAX(95 + 04 ; 100) = 99 (11 attempts) MAX(99 + 03 ; 100) = 100 (12 attempts) Then once you've snared the breaking point between 2 of these key floors, with the second egg, you'll try one floor after the other until you finally break it. The worst case scenarios are 13th floor (in 01 + 13 = 14 attemps) 26th floor (in 02 + 12 = 14 attemps) 38th floor (in 03 + 11 = 14 attemps) 49th floor (in 04 + 10 = 14 attemps) 59th floor (in 05 + 09 = 14 attemps) 68th floor (in 06 + 08 = 14 attemps) 76th floor (in 07 + 07 = 14 attemps) 83th floor (in 08 + 06 = 14 attemps) 89th floor (in 09 + 05 = 14 attemps) 94th floor (in 10 + 04 = 14 attemps) 98th floor (in 11 + 03 = 14 attemps) Wich seems like a better balanced solution. Sun Jan 29, 2017 3:23 am  by dolphin After the first breakage, you won't have 2 eggs to experiment with. :D Sun Jan 29, 2017 11:25 am  by Zelarith I never said so. Unless the first one breaks at floor 100, you'll always break the 2 eggs. You won't have any eggs left but you'll know where is the breaking point. But if you have a doubt with my answer, please, pick any floor, I'll show you how my answer takes at most 14 tries and 2 eggs to pin point the minimum floor at wich these eggs break. All times are GMT Page 1 of 1