(rooms)
| 5 | * @return {void} Do not return anything, modify rooms in-place instead. |
| 6 | */ |
| 7 | var wallsAndGates = function (rooms) { |
| 8 | const [rows, cols] = [rooms.length, rooms[0].length]; |
| 9 | |
| 10 | for (let row = 0; row < rows; row++) { |
| 11 | for (let col = 0; col < cols; col++) { |
| 12 | const isGate = rooms[row][col] === 0; |
| 13 | if (!isGate) continue; |
| 14 | |
| 15 | dfs(rooms, row, col); |
| 16 | } |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | const dfs = (rooms, row, col) => { |
| 21 | const [rows, cols] = [rooms.length, rooms[0].length]; |
nothing calls this directly
no test coverage detected