You have k eggs and a building with n floors (labeled 1 to n).
There exists a floor f (0 <= f <= n) on the building such that any egg dropped from a floor higher than f will break and, any egg dropped at or below f won't break.
Each move you can take an unbroken egg and drop it from any floor x (1 <= x <= n).
Find the minimum number of moves that you need to determine with certainty what the value of f is.
k: 1
n: 2
Answer: 2
Explanation:
Step 1: Drop from floor 1. If it breaks, f = 0.
Step 2: Drop from floor 2. If it breaks, f = 1. Else, f = 2.
We need atleast 2 moves to know with certainty the value of f.
The first line contains an integer ‘T’ denoting the number of test cases.
For each test case, the input has one line with two space-separated integers ‘k’ and ‘n’.
For each test case, the output contains a line with one integer denoting the minimum number of moves needed.
3
1 2
2 5
3 16
2
3
5
1 <= T <= 10
1 <= k <= 50
1 <= n <= 1000