Question: You are given a list coords representing the integer positions of various points on a 2 D grid, where coords [ i ] = [

You are given a list coords representing the integer positions of various points on a 2D grid, where coords[i]=[x,
yidefines the coordinates of the i-th point.
The distance between any two points is now calculated using a Minimum Distance Formula. You need to determine the smallest possible value of the largest distance between any two points after removing exactly one point from the list.
Minimum Distance Formula:
The distance between two points (x1,y1)(x1,y1) and (x2,y2)(x2,y2) is calculated as
maxi/x1- x2).ly1-y2|)max|x1-x2|,ly1- y2|) This formula gives the largest difference between the x or y coordinates of two points.
Return the minimum possible value for maximum distance between any two points by removing exactly one point.
Example 1:
Input: coords =[[2,8].[7,14),[9,3].[4,5]]
Output: 12
Explanation:
The maximum distance after removing each coord is the following:
After removing the Oth point the maximum distance is between coords (7,14) and (9,3), which is 17-9|+
114-31=13.
After removing the 1st point the maximum distance is between coords (2,8) and (9,3), which is |2-9|+
18-3=12
After removing the 2nd point the maximum distance is between coords (7,14) and (4,5), which is |7-4|
+14-5=12.
After removing the 3rd point the maximum distance is between coords (7,14) and (9,3), which is |7-9|+
114-3=13
12 is the minimum possible maximum distance between any two coords after removing exactly one coord.
Example 2:
Input: coords =((5,5],[5,5],[5,5]]
Output: 0
Explanation:
Removing any of the coords results in the maximum distance between any two coords of 0
Constraints:
3<= coords.length <=10^5
* coordslj length ==2
1<= coords[il[0], coords(i][1]<=1018

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!