Egg Dropping Puzzle with 2 Eggs and K Floors | C # program to find optimal number of trials for k floors and 2 eggs . ; Driver code
class GFG { static int twoEggDrop ( int k ) { return ( int ) System . Math . Ceiling ( ( - 1.0 + System . Math . Sqrt ( 1 + 8 * k ) ) / 2.0 ) ; } public static void Main ( ) { int k = 100 ; System . Console . WriteLine ( twoEggDrop ( k ) ) ; } }