long turn leke short turn aayi ismein ho gya wahi imp bas :D
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int nearestValidPoint(int x, int y, vector<vector<int>>& points) {\n\n        vector<pair<int,int>>vec;\n        for(int i=0;i<points.size();i++)\n        {\n            //if(points[i][0]==x||points[i][1]==y)\n                vec.push_back({points[i][0],points[i][1]});\n               \n        }\n\n        int min=INT_MAX;\n        int dist;\n        int ind=-1;\n\n        for(int i=0;i<vec.size();i++)\n        {\n            if(vec[i].first==x||vec[i].second==y)\n           { dist=abs(vec[i].first-x)+abs(vec[i].second-y);\n            if(dist<min)\n            {   min=dist;\n            ind=i;\n            }}\n        }\n        \n\n        return ind;\n        \n    }\n};\n```
['C++']