Test Cases
Case 1
Case 2
Input
[[1, 2], [3, 4], [2, -1]], [0, 0]
Output
[1, 2]
You're developing a feature for a mapping application where users can find the nearest store to their current location. Given a list of store locations (as coordinates) and a user's current location, write a function to find the store nearest to the user.
The function should take two parameters:
The function should return the (x, y)
coordinates of the store that is closest to the user's current location. If there are multiple stores at the same minimum distance, the function can return any one of them.
Example 1
Input: [[1, 2], [3, 4], [2, -1]], [0, 0]
Output: [1, 2]
Example 2
Input: [[0, 0], [5, 5], [2, 2]], [3, 3]
Output: [2, 2]
1 <= stores.length <= 10^4
-10^4 <= x, y <= 10^4
.Input
Output