Sponsored
Use these hints if you're stuck. Try solving on your own first.
Set each water cell to be 0. The height of each cell is limited by its closest water cell.
Perform a multi-source BFS with all the water cells as sources.
Solve with full IDE support and test cases