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 / ashutosh tiwari
Go to the middle floor, 50 in this case; drop egg, if breaks
go to middle of 1st and 50th i.e. 25th floor otherwise go to
middle of 50 and 100 i.e. 75th floor.
Keep on repeating the method to find the floor in minimum
iteration or egg breaking.
Hope this helps..!!!
| Is This Answer Correct ? | 5 Yes | 25 No |
Post New Answer View All Answers
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
application attempts to perform an operation?
Are enumerations really portable?
Does * p ++ increment p or what it points to?
What does 4d mean in c?
What is a struct c#?
How do I determine whether a character is numeric, alphabetic, and so on?
What is an example of structure?
How do I create a directory? How do I remove a directory (and its contents)?
Can a pointer point to null?
When c language was developed?
Is python a c language?
Explain what happens if you free a pointer twice?