Java same as rotting oranges || multisource bfs
\nclass Solution {\n    int[] dRow = {-1, 1, 0, 0};\n    int[] dCol = {0, 0, -1, 1};\n    public int[][] highestPeak(int[][] isWater) {\n        Queue<int[]> qu
```\nclass Solution {\n    int[] dRow = {-1, 1, 0, 0};\n    int[] dCol = {0, 0, -1, 1};\n    public int[][] highestPeak(int[][] isWater) {\n        Queue<int[]> queue = new LinkedList<>();\n        int m = isWater.length, n = isWater[0].length;\n        int[][] heights = new int[m][n];\n        for (int row = 0; row < m; row++) {\n            for (int col = 0; col < n; col++) {\n                if (isWater[row][col] == 1) queue.offer(new int[]{row, col});\n            }\n        }\n        while (!queue.isEmpty()) {\n            int[] arr = queue.poll();\n            int row = arr[0], col = arr[1];\n            for (int i = 0; i < 4; i++) {\n                int adjR = row + dRow[i], adjC = col + dCol[i];\n                if (adjR >= 0 && adjC >= 0 && adjR < m && adjC < n && isWater[adjR][adjC] == 0) {\n                    heights[adjR][adjC] = heights[row][col] + 1;\n                    isWater[adjR][adjC] = 1;\n                    queue.offer(new int[]{adjR, adjC});\n                }\n            }\n        }\n        return heights;\n    }\n}\n```
['Breadth-First Search', 'Java']