Python - Clean and Simple!
Solution:\n\nclass Solution:\n    def nearestValidPoint(self, x1, y1, points):\n        minIdx, minDist = -1, inf\n        for i,point in enumerate(points):\n  
**Solution**:\n```\nclass Solution:\n    def nearestValidPoint(self, x1, y1, points):\n        minIdx, minDist = -1, inf\n        for i,point in enumerate(points):\n            x2, y2 = point\n            if x1 == x2 or y1 == y2:\n                dist = abs(x1-x2) + abs(y1-y2)\n                if dist < minDist:\n                    minIdx = i\n                    minDist = min(dist,minDist)\n        return minIdx\n```
['Array', 'Python', 'Python3']