Simple java Solution
Complexity
Time complexity: O(n∗m) , where n is the number of rows and m is the number of columns in the matrix.

Space complexity:O(n∗m), where n is the number
# Complexity
- Time complexity: $$O(n*m)$$ , where `n` is the number of rows and `m` is the number of columns in the matrix.
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:$$O(n*m)$$, where `n` is the number of rows and `m` is the number of columns in the matrix.
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Pair{
    int row;
    int col;
    int dist;
    Pair(int row,int col,int dist){
        this.row = row;
        this.col = col;
        this.dist = dist;
    }
}
class Solution {
    public int[][] highestPeak(int[][] isWater) {
        //create a visited array 
        //create a distance matrix never alter the given matrix
        int n = isWater.length;
        int m = isWater[0].length;
        int[][]vis = new int[n][m];
        int [][]arr = new int[n][m];
        Queue<Pair> q = new LinkedList<>();
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(isWater[i][j]==1){
                    q.add(new Pair(i,j,0));
                    vis[i][j] = 1;
                }
                else{
                    vis[i][j]=0;
                }
            }
        }
        int []drow = {0,-1,0,1};
        int []dcol = {-1,0,+1,0};
        
        while(!q.isEmpty()){
            int row = q.peek().row;
            int col = q.peek().col;
            int dist = q.peek().dist;
            q.remove();
            arr[row][col]=dist;
            for(int i=0;i<4;i++){
                int nrow = row+drow[i];
                int ncol = col+dcol[i];
                if(nrow>=0&&nrow<n&&ncol>=0&&ncol<m&&vis[nrow][ncol]==0){
                    q.add(new Pair(nrow,ncol,dist+1));
                    vis[nrow][ncol]=1;
                }
            }
        }
        return arr;
    }
}
```
['Array', 'Breadth-First Search', 'Matrix', 'Java']