Java&Javascript Solution (JW)
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\nJava:\n```\npublic int nearestValidPoint(int x, int y, int[][] points) {\n    int index = -1; \n    for (int i = 0, smallest = Integer.MAX_VALUE; i < points.length; ++i) {\n        int dx = x - points[i][0], dy = y - points[i][1];\n        if (dx * dy == 0 && Math.abs(dy + dx) < smallest) {\n            smallest = Math.abs(dx + dy);\n            index = i;\n        }\n    }\n    return index; \n}\n```\nJavascript:\n```\n/**\n * @param {number} x\n * @param {number} y\n * @param {number[][]} points\n * @return {number}\n */\nvar nearestValidPoint = function(x, y, points) {\n    let index = -1; \n    for (let i = 0, smallest = Number.MAX_VALUE; i < points.length; ++i) {\n        let dx = x - points[i][0], dy = y - points[i][1];\n        if (dx * dy === 0 && Math.abs(dy + dx) < smallest) {\n            smallest = Math.abs(dx + dy);\n            index = i;\n        }\n    }\n    return index;\n};\n```
['Java', 'JavaScript']