1552. Magnetic Force Between Two Balls #287
Unanswered
mah-shamim
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has
n
empty baskets, theith
basket is atposition[i]
, Morty hasm
balls and needs to distribute the balls into the baskets such that the minimum magnetic force between any two balls is maximum.Rick stated that magnetic force between two different balls at positions
x
andy
is|x - y|
.Given the integer array
position
and the integerm
. Return the required force.Example 1:
Example 2:
Constraints:
n == position.length
2 <= n <= 105
1 <= position[i] <= 109
position
are distinct.2 <= m <= position.length
Beta Was this translation helpful? Give feedback.
All reactions