Click here to see the full article post
The following will only calculate n*(n-1)/2 points.
ROUND(SQRT(MIN((POW(p1.x - p2.x, 2) + POW(p1.y - p2.y, 2)))),2) AS shortest
point_2d p2 ON (p1.x <= p2.x AND p1.y <=p2.y)
and (p1.x != p2.x or p1.y != p2.y)
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.