✅[Python] Simple Solution
\ndef nearestValidPoint(self, x: int, y: int, points: List[List[int]]) -> int:\n        ans = -1\n        n = len(points)\n        mini = float(inf)\n        \n
```\ndef nearestValidPoint(self, x: int, y: int, points: List[List[int]]) -> int:\n        ans = -1\n        n = len(points)\n        mini = float(inf)\n        \n        for i in range(n):\n            if points[i][0]==x or points[i][1]==y:\n                dis = abs(points[i][0]-x) + abs(points[i][1]-y)\n                \n                if dis<mini:\n                    mini = dis\n                    ans = i\n                    \n        return ans\n```
['Python3']