Readable JavaScript DFS Solution
Code\n\n/**\n * @param {number[][]} heights\n * @return {number[][]}\n */\nvar pacificAtlantic = function(heights) {\n    let ROWS = heights.length \n    let CO
# Code\n```\n/**\n * @param {number[][]} heights\n * @return {number[][]}\n */\nvar pacificAtlantic = function(heights) {\n    let ROWS = heights.length \n    let COLS = heights[0].length\n    let pac = new Set()\n    let atl = new Set()\n    let res = []\n\n    function dfs(r, c, visit, prevHeight) {\n        if (Math.min(r,c) < 0 || r >= ROWS || c >= COLS || heights[r][c] < prevHeight || visit.has(r + \'-\' + c)) { //Checks for invalid entries\n            return \n        }\n\n        visit.add(r + \'-\' + c) //Valid entries gets added to set\n        dfs(r + 1, c, visit, heights[r][c]) //Checks neighbors\n        dfs(r - 1, c, visit, heights[r][c])\n        dfs(r, c + 1, visit, heights[r][c])\n        dfs(r, c - 1, visit, heights[r][c])\n    }\n\n    for (let c = 0; c < COLS; c++) { \n        dfs(0, c, pac, heights[0][c]) //Top\n        dfs(ROWS - 1, c, atl, heights[ROWS - 1][c]) //Bottom\n    }\n\n    for (let r = 0; r < ROWS; r++) { \n        dfs(r, 0, pac, heights[r][0]) //Left\n        dfs(r, COLS - 1, atl, heights[r][COLS - 1]) //Right\n    }\n\n    for (let r = 0; r < ROWS; r++) { //Checks for collisions\n        for (let c = 0; c < COLS; c++) {\n            if (pac.has(r + \'-\' + c) && atl.has(r + \'-\' + c)) { //If both sets have the same values\n                res.push([r,c]) //Push coord to res\n            }\n        }\n    }\n\n    return res\n};\n```
['Depth-First Search', 'JavaScript']