Egg Dropping Puzzle with 2 Eggs and K Floors | JavaScript program to find optimal number of trials for k floors and 2 eggs . ; Driver Code
function twoEggDrop ( k ) { return Math . ceil ( ( - 1.0 + Math . sqrt ( 1 + 8 * k ) ) / 2.0 ) ; } var k = 100 ; document . write ( twoEggDrop ( k ) ) ;