🦚 | 100% beaten golang solution | self-explanatory
Code\n\nfunc nearestValidPoint(x int, y int, points [][]int) int {\n    mn := 10000\n    ans := -1\n    for ind, point := range points {\n        if point[0] ==
# Code\n```\nfunc nearestValidPoint(x int, y int, points [][]int) int {\n    mn := 10000\n    ans := -1\n    for ind, point := range points {\n        if point[0] == x || point[1] == y{\n            if mn >int(math.Abs(float64(x - point[0])) + math.Abs(float64(y - point[1]))) {\n                mn = int(math.Abs(float64(x - point[0])) + math.Abs(float64(y - point[1])))\n                ans = ind\n            }\n        }\n    }\n    return ans\n}\n```
['Go']