Egg Problem

You are given 2 eggs and an integer N denoting number of floors in a building. There is Xth floor in same building from which if egg is dropped, it will break but it will not break if dropped from X-1,X-2,X-3,…2,1 .

Note: If egg dropped from Xth floor breaks, it will surely break if dropped from X+1,X+2,…,N.

You have to tell minimum number of iterations/test in which value of X can be found.

Suppose first egg is dropped from floor N and egg breaks then you will have to check from 1 to N-1 floor. That makes total N checks.

		If egg doesn't break from floor N then try from N+(N-1) floor and if egg breaks then check for every floor from (N+1)th to (N+(N-1)-1)th floor, that makes N checks. (one at N, Second at N+(N-1),and N-2 checks from N+1 to N+(N-1)-1).

		If egg doesn't break at N+(N-1) then try at N+(N-1)+(N-2) th floor.
		and so on ...
		so in worst case only N checks are required.
		
		N+(N-1)+(N-2)+ ...  + 2+ 1 >= no_of_floors.

        solve N*(N+1)/2  >= No_of_Floors
//