Egg Dropping Puzzle with 2 Eggs and K Floors | Java program to find optimal number of trials for k floors and 2 eggs . ; Driver code
import java . io . * ; class GFG { static int twoEggDrop ( int k ) { return ( int ) Math . ceil ( ( - 1.0 + Math . sqrt ( 1 + 8 * k ) ) / 2.0 ) ; } public static void main ( String [ ] args ) { int k = 100 ; System . out . println ( twoEggDrop ( k ) ) ; } }