👩‍💻 Javascript: Arrow function with reduce O(N)
\nconst nearestValidPoint = (x, y, points, min = Infinity) => \n    points.reduce((res, [a,b], idx) => {\n        if(a===x || b===y){\n            const dist = 
```\nconst nearestValidPoint = (x, y, points, min = Infinity) => \n    points.reduce((res, [a,b], idx) => {\n        if(a===x || b===y){\n            const dist = Math.abs(x-a) + Math.abs(y-b)\n            if(dist<min){\n                res = idx;\n                min = dist;\n            }\n        }\n        return res\n    }, -1)\n```\n\nOpen for suggestion
['JavaScript']