The first line of the input contains an integer 'T' denoting the number of test cases.
The first line of each test case contains two space-separated integers 'N' and 'M', the number of jars, and the minutes after which his mother comes back.
The second line of each test case contains 'N' space-separated integers, the number of chocolates present in 'N' jars.
For every test case, the only line of output should contain an integer 'X', the minimum chocolate-eating speed of Ninja as described in the problem statement.
Print the output of each test case in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 10^6
N <= M <= 10^9
1 <= chocolates[i] <= 10^9
Time limit: 1 sec
The brute force approach to this problem is that we continuously iterate on the speed of eating chocolates till Ninja can eat all the chocolates within βMβ Minutes.
Algorithm:
Since our search space(βchocolatesβ) is very high, we can use binary search to efficiently find the minimum chocolate-eating speed. We can use the fact that if βXβ is the minimum eating speed, then every value which is larger than βXβ will also satisfy the condition.
Algorithm: