EASY CPP implementation of Multi-Source-BFS
IntuitionMulti source BFS
First we can make all the water cells equal to 0 and then make other land cells as unvistited by marking them with -1
And on these cel
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Multi source BFS 
First we can make all the water cells equal to 0 and then make other land cells as unvistited by marking them with -1
And on these cells we can do multi source BFS
# Approach
<!-- Describe your approach to solving the problem. -->
We can push indices of all water cells
We can make a dir array (int dir[5] = {0,1,0,-1,0};)
This specifies down,left,up,right
For all the values in queue we do bfs in all directions and check if they are in bounds 
If they are in bounds and they are unvisited we can make the height = 1 + height of previous cell
we do this till the queue is empty and then we can return the water matrix 

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
    O(n*m)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
    O(n*m)
# Code
```cpp []
class Solution {
public:
    vector<vector<int>> highestPeak(vector<vector<int>>& water) {
        queue<pair<int,int>>q;
        int n = water.size();
        int m = water[0].size();
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(water[i][j]==1){
                    water[i][j] = 0;
                    q.push({i,j});
                }else water[i][j] = -1;
            }
        }
        int dir[5] = {0,1,0,-1,0};
        while(q.size()){
            auto top = q.front();
            q.pop();
            int x = top.first;
            int y = top.second;
            for(int i=0;i<4;i++){
                int nx = x + dir[i];
                int ny = y + dir[i+1];
                if(nx>-1 && nx<n && ny>-1 && ny<m && water[nx][ny]==-1){
                    water[nx][ny] = 1+water[x][y];
                    q.push({nx,ny});
                }
            }
        }return water;
    }
};
['Array', 'Breadth-First Search', 'Matrix', 'C++']