Loading problem...
You are given a table named Point2D where each row is a unique point on a Cartesian plane.
Schema:
The pair (x, y) is unique across the table.
Define the Euclidean distance between two points (x1, y1) and (x2, y2) as:
Task:
This problem should be solved in both:
Point2D:
| x | y |
|----|----|
| -1 | -1 |
| 0 | 0 |
| -1 | -2 |[
{"shortest":1.0}
]The closest pair is (-1, -1) and (-1, -2), which are 1.00 unit apart.
Point2D:
| x | y |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 4 | 4 |[
{"shortest":1.41}
]The nearest pair is (0, 0) and (1, 1). Distance is sqrt(2), rounded to 1.41.
Point2D:
| x | y |
|----|---|
| -5 | 2 |
| -1 | 2 |
| 2 | 5 |
| 2 | 6 |[
{"shortest":1.0}
]The nearest pair is (2, 5) and (2, 6), demonstrating that closest points can share the same x-coordinate.
Constraints