java solution || using bfs || queue
\nclass Solution {\n    \n    public int[][] highestPeak(int[][] isWater) {\n        int row = isWater.length;\n        int col = isWater[0].length;\n        in
```\nclass Solution {\n    \n    public int[][] highestPeak(int[][] isWater) {\n        int row = isWater.length;\n        int col = isWater[0].length;\n        int [][] ans = new int[row][col];\n        Queue<Pair<Integer , Integer>> q = new LinkedList<>(); // queue of pair to store index \n        for(int i=0;i<row ;i++){\n            for(int j=0;j<col ;j++){\n                if(isWater[i][j] == 1){\n                    ans[i][j] =0;\n                    q.offer(new Pair(i , j));\n                }else{\n                    ans[i][j]= -1;\n                }\n            }\n        }\n        int[] dir = new int[] {0,1,0,-1,0}; \n        while(q.size()>0){\n            Pair<Integer , Integer> p = q.poll();\n            int cr = p.getKey() ; //cr represent current_row\n            int cc = p.getValue(); // cc represent current_column\n            \n            for(int i=0;i<4 ;i++){\n                int ncr = cr+dir[i]; int ncc = cc+dir[i+1]; // ncr -> new current row , ncc -> new current column\n                if(ncr<0 || ncr>=row || ncc<0 || ncc>= col || ans[ncr][ncc] != -1){\n                    continue;\n                }\n                ans[ncr][ncc] = 1+ ans[cr][cc];\n                q.offer(new Pair(ncr , ncc));\n            }            \n        }\n        return ans;\n    }\n}\n```
['Breadth-First Search', 'Queue', 'Java']