Python Solution 
IntuitionGrid Representation: The isWater grid represents a 2D map where 1 indicates water cells and 0 indicates land cells.Objective: Determine the height of e
# Intuition
Grid Representation: The isWater grid represents a 2D map where 1 indicates water cells and 0 indicates land cells.

Objective: Determine the height of each land cell, where the height represents the minimum distance to the nearest water cell.

# Approach
1. Initialization:

heights: A 2D array to store the calculated height of each cell. Initially, all cells are set to -1 (unvisited).
queue: A deque (double-ended queue) for performing breadth-first search (BFS).

2. Find Water Cells:

Iterate through the isWater grid:
For each water cell (value 1), set its height in the heights array to 0 and enqueue it in the queue.

3. BFS:

While the queue is not empty:
Dequeue a water cell (x, y) from the front of the queue.
Explore its four neighboring cells:
If a neighboring cell is within the grid bounds and its height is still -1 (unvisited):
Set the height of the neighboring cell to the height of the current cell plus 1.
Enqueue the neighboring cell.

4. Return Heights:

After the BFS completes, the heights array will contain the calculated heights of all land cells. Return this array.
# Complexity
- Time complexity:
O(M*N)

- Space complexity:
O(M*N)

# Code
```python3 []
class Solution:
    def highestPeak(self, isWater: List[List[int]]) -> List[List[int]]:
        m, n = len(isWater), len(isWater[0])
        heights = [[-1] * n for _ in range(m)] 
        queue = deque()
        directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]      
        for i in range(m):
            for j in range(n):
                if isWater[i][j] == 1:
                    heights[i][j] = 0
                    queue.append((i, j))      
        while queue:
            x, y = queue.popleft()
            for dx, dy in directions:
                nx, ny = x + dx, y + dy
                if 0 <= nx < m and 0 <= ny < n and heights[nx][ny] == -1:
                    heights[nx][ny] = heights[x][y] + 1
                    queue.append((nx, ny))
        return heights
```
['Python3']