Python. Beats 99%, based on double ended Q.
IntuitionIntitally tried priority Q, but because priority of scheduled events monotoniocally increasing -> DQ is best candidate here.Logic is easy, for each cel
# Intuition
Intitally tried priority Q, but because priority of scheduled events monotoniocally increasing -> DQ is best candidate here.

Logic is easy, for each cell="water" schedule it's processing:
- put in Q
- pop from Q, and look for adjacent cells which are not processed yet
- if adjacent cell is not processed, mark it with height and schedule it's processing in Q

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

# Complexity
- Time complexity:
O(N)

- Space complexity:
O(N)

# Code
```python3 []
class Solution:
    def highestPeak(self, isWater: List[List[int]]) -> List[List[int]]:
        pq = deque()
        for row_id, row in enumerate(isWater):
            for col_id, val in enumerate(row):
                if val:                    
                    isWater[row_id][col_id]=0
                    # schedule processing
                    pq.append([1, (row_id, col_id)])
                else:
                    isWater[row_id][col_id] = None
        
        m=len(isWater)
        n=len(isWater[0])
            
        while pq:            
            p, (r,c) = pq.popleft()
            #p+=1       
            if r>0 and isWater[r-1][c] is None:
                pq.append([p+1, [r-1, c]])
                isWater[r-1][c] = p
            if r+1<m and isWater[r+1][c] is None:
                pq.append([p+1, [r+1, c]])
                isWater[r+1][c] = p
            if c>0 and isWater[r][c-1] is None:
                pq.append([p+1, [r, c-1]])
                isWater[r][c-1] = p
            if c+1<n and isWater[r][c+1] is None:
                pq.append([p+1, [r, c+1]])
                isWater[r][c+1] = p               
        
        return isWater



        
```
['Python3']