C++ | O(n) Time complexity | FASTER THAN 96.04%
\nclass Solution {\npublic:\n    int nearestValidPoint(int x, int y, vector<vector<int>>& points) {\n        int minimum_manhattan = INT_MAX;\n        int index
```\nclass Solution {\npublic:\n    int nearestValidPoint(int x, int y, vector<vector<int>>& points) {\n        int minimum_manhattan = INT_MAX;\n        int index = -1;\n        for (int i = 0; i < points.size(); i++) {\n            if(points[i][0] == x || points[i][1] == y) {\n                int manhattan = abs(points[i][0] - x) + abs(points[i][1] - y);\n                if (manhattan < minimum_manhattan) {\n                    minimum_manhattan = manhattan;\n                    index = i;\n                }\n            }\n        }\n        return index;\n    }\n};\n```
['C']