
Let’s say the array ‘L’ = [1, 3, 4, 5] and 'K' = 2 then after bombing at position ‘2’ with a bomb of power ‘1’, enemies in the range [1, 3] will be destroyed. So the remaining enemy will be at position [4, 5]. These two can be bombed by placing another bomb at position '4'. Hence, the power is '1'.
First-line contains ‘T’, denoting the number of Test cases.
For each Test case:
The first line contains two space-separated integers, ‘N’ and ‘K’, denoting the number of enemies and number of bombs you have.
The following line contains an array ‘L’ of ‘N’ space-separated distinct positive integers representing the enemy’s location.
For each test case, you have to print a non-negative integer denoting the minimum power of the bomb, such that it is possible to destroy every enemy.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^5
1 <= ‘K’ <= 1000
1 <= L[i] <= 10^9, for 1 <= i <= ‘N’
Note- Sum of ‘N’ over all test cases does not exceed 10^5.
Time Limit: 1 sec
Algorithm:
Algorithm:
Element Count in Ranges
First Digit One
Minimize Maximum Adjacent Distance
Sorted Doubly Linked List to Balanced BST
Minimized Maximum of Products Distributed to Any Store