dijkstra, coded in c++
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {
        int n = isWater.size();
        int m = isWater[0].size();
        vector<vector<bool>> visited(n ,vector<bool>(m,false));
        queue<pair<int,int>> q;
        for(int i = 0; i<n; ++i){
            for(int j = 0; j<m; ++j){
                if(isWater[i][j]==1){
                    visited[i][j] = true;
                    isWater[i][j] = 0;
                    q.push({i,j});
                }
            }
        }
        int height = 1;
        vector<int> dx = {0,0,1,-1}, dy = {1,-1,0,0};
        while(!q.empty()){
            int size = q.size();
            while(size--){
                auto [x,y] = q.front();
                q.pop();
                for(int i=0;i<4;++i){
                    int nx=x+dx[i],ny=y+dy[i];
                    if(nx<0||nx>=n||ny<0||ny>=m||visited[nx][ny]) continue;
                    isWater[nx][ny]=height;
                    visited[nx][ny]=true;
                    q.push({nx,ny});
                }
            }
            height++;
        }
        return isWater;
    }
};
```
['C++']