2 Eggs 100 Floors Question

Then we have to test floors 1 13 with the 2nd egg to.
2 eggs 100 floors question. If the egg breaks the nth floor is between 49 and 2 if not we know the nth floor is between 51 and 99 we know the egg will not break if dropped from the first floor because it is the minimum distance you can drop the egg and we know that the egg will break at floor 100 the maximum distance you can drop the egg. If an egg is dropped and does not break it is undamaged and can be dropped again. 2 eggs 100 floors interview question. 2 eggs 100 floors.
The solution for the worst case in this scenario occurs when the threshold floor is floor number 14 because we will drop the first egg on floor 14 and it will break. At worst it will be seven eggs if the floor is actually floor 1 since every drop will break the egg. 4 we first try from 4 th floor. The aim is to find out the highest floor from which an egg will not break when dropped from a floor.
Suppose that we wish to know which stories in a 100 story building are safe to drop eggs from and which will cause the eggs to break on landing. You are given two eggs and you are in a building with 100 floors. You have to do this in such a manner that your worst case number of attempts is minimized. Two results break or not.
The solution for the worst case in this scenario occurs when the threshold floor is floor number 14 because we will drop the first egg on floor 14 and it will break. Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor both eggs are identical. Then we have to test floors 1 13 with the 2nd egg to see where the egg breaks again and the egg will not break on any of those floors. 2 eggs 100 floors worst case solution.
One of the floors is the highest floor an egg can be dropped from without breaking. Given 2 eggs and k floors find the minimum number of trials needed in worst case. 2 eggs and 100 floor google classic question. Two cases arise 1 if egg breaks we have one egg left so we need three more trials.
You have to find the minimum floor from which if an egg is dropped it won t break. Depending on the final answer the actual number of eggs broken using a binary search will vary. 2 eggs 100 floors worst case solution. Both eggs are identical.
You are given two eggs and access to a 100 storey building. Let s talk about the 2 egg problem courtesy of interview cake. This problem is a specific case of n eggs and k floors. A building has 100 floors.
At best it will be no eggs if the actually answer is floor 100 since the egg will survive every drop made. K 10 output. Abhi jain november 30 2018 uncategorized 0. The following is a description of the instance of this famous puzzle involving 2 eggs and a building with 100 floors.
You have access to a 100 storey building. You need to figure out the highest floor of a 100 storey building an egg can be dropped without breaking.