A simple Euclidian distance solution!


  • 0
    B
    # Write your MySQL query statement below
    select round(SQRT(min(pow(P1.y-P2.y,2)+pow(P1.x-P2.x,2))),2) as shortest
    from point_2d P1,point_2d P2
    where P1.x <> P2.x or P1.y <> P2.y
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.