Find Nearest Point That Has the Same X or Y Coordinate

Find Nearest Point That Has the Same X or Y Coordinate - Coding Problem | K5kC