points on a plane, where points[i] = [x, y] are integer coordinates. The distance between points is measured along the grid: between (x1, y1) and (x2, y2) it is |x1 − x2| + |y1 − y2|.
The **span** of a set is the largest such distance between two of its points. Remove exactly one point so that the span of the rest is as small as possible, and return that span.
Points may coincide.points=[[1, 1], [2, 5], [6, 2], [20, 20]] → 7
The point (20, 20) is far from the rest, so we drop it. Among the others the farthest pair is (2, 5) and (6, 2): |2 − 6| + |5 − 2| = 7.
points=[[4, 4], [4, 4], [9, 1]] → 0
Dropping (9, 1) leaves two identical points, 0 apart.
points=[[1, 1], [3, 3], [5, 5], [7, 7]] → 8
points=[[1, 1], [2, 5], [6, 2], [20, 20]]
7
Run checks the first 3 tests in your browser. Submit checks all 155 tests on the server, hidden ones included.