Given an array A of N integers where each value represents number of chocolates in a packet.
i-th can have A[i] number of chocolates.
There are B number students, the task is to distribute chocolate packets following below conditions:
1. Each student gets one packet. 2. The difference between the number of chocolates in packet with maximum chocolates and packet with minimum chocolates given to the students is minimum.
Return the minimum difference (that can be achieved) between maximum and minimum number of chocolates distributed.
0 <= N <= 10^5 1 <= A[i] <= 10^6 0 <= B <= 10^5
A : [3, 4, 1, 9, 56, 7, 9, 12] B : 5
Minimum Difference is 6 The set goes like 3,4,7,9,9 and the output is 9-3 = 6
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.