You are given an integer array position[] representing the positions of balls on a number line and an integer m representing the number of balls to place. You must place exactly m balls in the given positions. The magnetic force between two balls is defined as the absolute distance between their positions. Your task is to place the balls such that the minimum magnetic force between any two balls is maximized. Return the maximum possible minimum magnetic force.
Topics
Companies
Articles
Examples:
N/A
Constraints:
2 = position.length = 105
1 = position[i] = 10?
All position[i] are distinct
2 = m = position.length
Companies:
AmazonMicrosoftAppleSamsungVisa + 1 more
Topics:
Binary Search
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.
Access Restricted: Please Login to access the code editor and test cases.