
Given a list of 2D points points, where each point is represented as [x, y], and a target point [tx, ty], return the point that is closest to the target using Euclidean distance. If multiple points have the same minimum distance, return the one that appears first in the input list. Return [] if the input list is empty.
Example 1:
Input: points = [[1, 2], [3, 4], [0, 1]], target = [0, 0]
Output: [0, 1]
Explanation: Distances are 5, 25, and 1 using squared Euclidean distance.
Example 2:
Input: points = [[5, 5], [2, 1], [2, 2]], target = [2, 0]
Output: [2, 1]
Explanation: [2, 1] has the smallest distance to [2, 0].
0 <= len(points) <= 10^5points[i].length == 2target.length == 2-10^4 <= x, y, tx, ty <= 10^4points = [[1, 2], [3, 4], [0, 1]], target = [0, 0]Output[0, 1]Why[0, 1] has squared distance 1, which is smaller than the others.points = [[5, 5], [2, 1], [2, 2]], target = [2, 0]Output[2, 1]Why[2, 1] is 1 unit away vertically, so it is the closest point.0 <= len(points) <= 10^5points[i].length == 2target.length == 2-10^4 <= x, y, tx, ty <= 10^4def closest_point(points, target):