There is a 100-story building and you are given two eggs.
The eggs (and the building) have an interesting property
that if you throw the egg from a floor number less than X,
it will not break. And it will always brake if the floor
number is equal or greater than X. Assuming that you can
reuse the eggs which didn't broke; you got to find X in a
minimal number of throws. Give an algorithm to find X in
minimal number of throws.
Answer Posted / chalimar
We are confused by the telling of this puzzle. Does the question really ask the minimum number of throws, or the minimum number of eggs? The second possibility is suggested by the clause, "Assuming that you can reuse the eggs which didn't [brake]." One answer here has made that presumption, starting at the first floor and going up floor by floor.
| Is This Answer Correct ? | 0 Yes | 18 No |
Post New Answer View All Answers
How do you determine the length of a string value that was stored in a variable?
What is the main difference between calloc () and malloc ()?
In which language linux is written?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
Hi can anyone tell what is a start up code?
What are the properties of union in c?
Why we not create function inside function.
What does printf does?
Can we declare variables anywhere in c?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
Explain how can you restore a redirected standard stream?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
Explain what does a function declared as pascal do differently?
Write a code to generate divisors of an integer?
What is the explanation for modular programming?