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


Please Help Members By Posting Answers For Below Questions

What does s c mean on snapchat?

579


What does %c do in c?

578


What are the types of pointers in c?

525


Explain how can I remove the trailing spaces from a string?

621


What is type qualifiers?

653






What is the use of volatile?

602


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4169


What is binary tree in c?

617


What is wild pointer in c?

601


Differentiate between calloc and malloc.

750


What are enums in c?

651


What is d'n in c?

624


What is the difference between constant pointer and constant variable?

742


Differentiate between Macro and ordinary definition.

720


What are the ways to a null pointer can use in c programming language?

586