Python Easy and Small Solution
```\nclass Solution:\n    def nearestValidPoint(self, x: int, y: int, points: List[List[int]]) -> int:\n        \n        li=[i for i in points if i[0]==x or i[
```\nclass Solution:\n    def nearestValidPoint(self, x: int, y: int, points: List[List[int]]) -> int:\n        \n        li=[i for i in points if i[0]==x or i[1]==y]   #chosse points where x or y is same\n        if(len(li)==0):  \n            return -1\n        ans=0\n        mn=float(\'inf\')     #it is same as in c++ -> int_max\n        for i in li:\n            dist=abs(x-i[0])+abs(y-i[1])\n            if(mn>dist):\n                ans=i\n                mn=dist    \n        return points.index(ans)\n            \n
['Python']