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 pointer to pointer in c?
What is the meaning of 2d in c?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What are the types of data types and explain?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Write a program of advanced Fibonacci series.
I heard that you have to include stdio.h before calling printf. Why?
Explain what is the use of a semicolon (;) at the end of every program statement?
What does the c preprocessor do?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
Write a program to know whether the input number is an armstrong number.
What does nil mean in c?
What is default value of global variable in c?
What does. int *x[](); means ?
how is the examination pattern?