Magnetic Force Between Two Balls
MediumLeetCodeBinary Search on Answer
Approach hintTry it first, then revealHide
Sort the positions and binary search the minimum gap. A gap is feasible if greedily placing each ball at the first position at least that far from the previous ball fits all m balls.