Solution using BFS [Time: O(MN), Space: O(MN)]
Steps:\n- Collect all the cell that has water and mark the height as 0\n- Fetch all the neighbours and mark them as previous value + 1\n- Repeat the step until 
Steps:\n- Collect all the cell that has water and mark the height as 0\n- Fetch all the neighbours and mark them as previous value + 1\n- Repeat the step until all the block are processed\n\nTime Complexity: O(MN)\nSpace Complexity: O(MN)\n\n```\nclass Solution {\n    public int[][] highestPeak(int[][] isWater) {\n        int[][] result = new int[isWater.length][isWater[0].length];\n        for(int[] row: result) \n            Arrays.fill(row, Integer.MAX_VALUE);\n        \n        Queue<Pair<Integer, Integer>> queue = new LinkedList<>();\n        for(int i=0; i<isWater.length; ++i)\n            for(int j=0; j<isWater[i].length; ++j)\n                if (isWater[i][j] == 1)\n                    queue.add(new Pair(i, j));\n        \n        int height = 0;\n        while(!queue.isEmpty()) {\n            int size = queue.size();\n            while(size-- > 0) {\n                Pair<Integer, Integer> xy = queue.poll();\n                int x = xy.getKey(), y = xy.getValue();\n                // Boundary condition\n                if (x<0 || y<0 || x>=result.length || y>=result[x].length)\n                    continue;\n                // Check if it is already visited with less height\n                if (result[x][y] <= height)\n                    continue;\n                result[x][y] = height;\n                queue.add(new Pair(x, y+1));\n                queue.add(new Pair(x, y-1));\n                queue.add(new Pair(x+1, y));\n                queue.add(new Pair(x-1, y));\n            }\n            ++height;\n        }\n        \n        return result;\n    }\n}\n```
['Breadth-First Search', 'Java']