
Each result of the division is rounded to the nearest integer greater than or equal to that element. For Example, 7/3 = 3.
The first line contains an integer ‘n’ denoting the number of elements in the array.
The second line contains ‘n’ Space-separated integers denoting the elements of the array.
The third line contains an integer ‘limit’ denoting the given 'limit'.
Print an integer denoting the minimum divisor.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
The approach is to find the minimum divisor from 1 to the maximum element of the input array. We keep on selecting the divisor until we get the result.
The idea is to optimize the search space which is from 1 to 10 ^ 6 by using the binary search technique. Calculate the mid for every search space and accordingly adjust the high and low values.