2
public int minimizedMaximum(int n, int[] quantities) {11
int mid = (lo + hi) / 2;13
if (isItPossible(mid, quantities, n)) {24
private boolean isItPossible(int x, int[] quantities, int n) {26
// isItPossible to distribute <= x products to each of the n shops27
for (int i = 0; i < quantities.length; i++) {29
int products = quantities[i];31
n -= Math.ceil(products / (x * 1.0));33
if (n < 0) // means it requires more than n shops to distribute all products37
return true; // distributed all products to exactly n shops