BFS solving AND how to think about it? 
Intuitionthe problem is ask us to fill the heights with maximum as possible such that the DIFFERENCE between any two adjancet cells is at most 1Approachif you t
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
the problem is ask us to fill the heights with **maximum** as possible such that the DIFFERENCE between any two adjancet cells is at most 1
# Approach
<!-- Describe your approach to solving the problem. -->
if you think like this: 
`"let's put all the cells with zeros or ones so we can solve the problem"` 
but Notice that, the problem as us to find the heights with **MAXIMUM**.

let have this example:
```
 0  0 `1`
`1` 0  0
 0  0  0
```
notice here you have two cells with water, so the heights will be for each once is 0.
==> 
```
 *  * `0`
`0` *  *
 *  *  *
```
now we must begin with these nodes (that has water), to ensure we have the DIF(between any two adjacent cell) at most 1 

* in cell[0][2]: we have to put everything around it with 1
* in cell[1][0]: we have to put everything around it with 1

```
 1  1 `0`
`0` 1  1
 1  *  *
```
* after that, everythink around the 1 must be 2 
* so on..

NOW, we must have **ordering** with put every think, so let use the **QUEUE** 

The Solution will be:
1. put all the cells that have water with height = 0, and the others with -1 (or any UNIQUE number that you don't use it)
2. add the cells that have water in the QUEUE to traverse First
3. in QUEUE: take the first cells and put all the around it with `myheight + 1', and then add these cells in the queue.


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

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

# Code
```csharp []
public class Solution {
    public int[][] HighestPeak(int[][] isWater) {
        Queue<Tuple<int,int>> queue = new();
        int n = isWater.Length, m = isWater[0].Length;
        int[][] heights = new int[n][];
        for(int i=0;i<n;i++)
            heights[i] = new int[m];
        

        // 1.2. put the height & add the cells that have water in QUEUE
        for(int i=0;i<n;i++) {
            for(int j=0;j<m;j++) {
                if(isWater[i][j] == 1) {
                    heights[i][j] = 0;
                    queue.Enqueue(new Tuple<int,int>(i,j)); 
                }
                else{
                    heights[i][j] = -1;
                }
            }
        }

        // take the cell in the queue, and put all the around it with height+1
        while(queue.Count > 0)
        {
            var pair = queue.Dequeue();
            int x = pair.Item1, y = pair.Item2;
            int[] dx={1,-1,0,0};
            int[] dy={0,0,1,-1};
            for(int i=0;i<4;i++)
            {
                int newx = x + dx[i];
                int newy = y + dy[i];
            if(newx>=0 && newy>=0 && newx<n && newy<m && heights[newx][newy] == -1)
            {
                heights[newx][newy] = heights[x][y]+1;
                queue.Enqueue(new Tuple<int,int>(newx, newy));
            }
            }
        }
        return heights;
    }
}   

```
['Breadth-First Search', 'Queue', 'C#']