JAVA | EASY CODE 3ms Solution
\n        int min=Integer.MAX_VALUE;\n        int index=-1;\n        int dist=0;\n        for(int i=0;i<points.length;i++){\n            if(points[i][0]==x||poi
\n        int min=Integer.MAX_VALUE;\n        int index=-1;\n        int dist=0;\n        for(int i=0;i<points.length;i++){\n            if(points[i][0]==x||points[i][1]==y){\n                dist = Math.abs(points[i][0]-x) + Math.abs(points[i][1]-y);\n                if(dist<min){\n                    min=dist;\n                    index=i;\n                }\n            }\n            \n        }\n        return index;\n
[]