#1765

Map of Highest Peak

pupil · 490 · lc medium +27 · verified · 75.7% accepted · 1,551 likes · top 87%

Description

You are given an integer matrix isWater where 1 marks water and 0 marks land. Assign non-negative heights so water cells have height 0 and adjacent cells differ by at most 1. Maximize the tallest height. Return any valid height matrix.

Code

1
2
3