C++ | BFS | Beats 100% | Only code , not explained
Code
# Code
```cpp []
class Solution {
public:
    vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
        int m = isWater.size();
        int n = isWater[0].size();
        vector<vector<int>> vec(m , vector<int> (n,-1));
        queue<pair<int , int>> q;
        for(int i{0} ; i < m ; i++){
            for(int j{0} ; j < n ; j++){
                if(isWater[i][j] == 1){
                    vec[i][j] = 0;
                    q.push({i, j});
                }
            }
        }
        while(q.empty()!=true){
            pair<int, int> temp = q.front();
            q.pop();
            int i = temp.first;
            int j = temp.second;

            if(i-1 >= 0 && vec[i-1][j]==-1){
                vec[i-1][j] = vec[i][j] + 1;
                q.push({i-1 , j});
            }
            if(j-1>=0 && vec[i][j-1]==-1){
                vec[i][j-1] = vec[i][j] + 1;
                q.push({i, j-1});
            }
            if(i+1 < m && vec[i+1][j] == -1){
                vec[i+1][j] = vec[i][j] + 1;
                q.push({i+1,j});
            }
            if(j+1 < n && vec[i][j+1]== -1){
                vec[i][j+1] = vec[i][j] + 1;
                q.push({i, j+1});
            }
        }
        return vec;
    }
};
```
['Breadth-First Search', 'C++']