>>>>>>Hi everybody,
>>>>>>
>>>>>>This is a puzzle, which could be asked on a interview. I could not find a best answer.
>>>>>>
>>>>>>There is a 100 floor building. You have two glass balls. You need to find out the floor number, starting from which these balls will broke by minimal number of steps.
>>>>>>
>>>>>
>>>>>What is definition of a step in this case?
>>>>
>>>>I think, one dropping of a ball is a step.
>>>
>>>Are you saying that I need to find out the lowest floor of this building where a glass ball will break when dropped and I need to explain how it could be determined in the least number of actions?
>>>
>>>Renoir
>>
>>Yes, exactly. Thanks for translating this problem into proper English for me :)
>
>Go to floors:
>14
>27
>39
>50
>60
>69
>< and so on, going adding 1 less floor each time >
>99
>
>If ball breaks at any floor, go to previous step+1, and go to each floor in ascending order.
>
>Max steps=14, occurring at at 13, 26, 38, 49, etc. I chose 14 as the starting point because the sum of n + (n - 1) + (n - 2)... series for n=14 is the lowest n that gives a result greater than 100.
>
>I don't recall how to express this in the proper mathematical terminology...
Yes, I think, that's the best algorithm. Can I give you three stars? :)
If it's not broken, fix it until it is.
My Blog