100% easy beat || O(N) sol. || beginner friendly sol. || 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int nearestValidPoint(int x, int y, vector<vector<int>>& points) {
        int mini_dis = INT_MAX, ans = -1;

        for(int i = 0; i < points.size(); i++) {
            int a = points[i][0], b = points[i][1];

            if(a == x || b == y) {
                int current = abs(a - x) + abs(b - y);
                
                if(current < mini_dis) {
                    mini_dis = current;
                    ans = i; 
                }
            }
        }
        return ans;
    }
};

```
['Array', 'Python', 'C++', 'Python3']