Minimize Manhattan Distances - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
3102. Minimize Manhattan Distances
Hard
50 Points
Array
Math
Geometry
Sorting
Ordered Set
You are given an array points representing integer coordinates of some points on a 2D plane, where points[i] = [xi, yi].
The distance between two points is defined as their Manhattan distance.
Return the minimum possible value for maximum distance between any two points by removing exactly one point.
Examples
Example 1
Input: points = [[3,10],[5,15],[10,2],[4,4]]
Output: 12
Explanation:
The maximum distance after removing each point is the following:
12 is the minimum possible maximum distance between any two points after removing exactly one point.
Example 2
Input: points = [[1,1],[1,1],[1,1]]
Output: 0
Explanation:
Removing any of the points results in the maximum distance between any two points of 0.
Constraints
3 <= points.length <= 105
points[i].length == 2
1 <= points[i][0], points[i][1] <= 108
3102. Minimize Manhattan Distances
Hard
50 Points
Array
Math
Geometry
Sorting
Ordered Set
You are given an array points representing integer coordinates of some points on a 2D plane, where points[i] = [xi, yi].
The distance between two points is defined as their Manhattan distance.
Return the minimum possible value for maximum distance between any two points by removing exactly one point.
Examples
Example 1
Input: points = [[3,10],[5,15],[10,2],[4,4]]
Output: 12
Explanation:
The maximum distance after removing each point is the following:
12 is the minimum possible maximum distance between any two points after removing exactly one point.
Example 2
Input: points = [[1,1],[1,1],[1,1]]
Output: 0
Explanation:
Removing any of the points results in the maximum distance between any two points of 0.