← 返回 bytedance 的题目列表Find and Modify Boundary of a Picture in a Grid
类型:online_judge
bytedance
In a grid, there is a picture represented by 1s with the rest of the grid containing 0s. Find this picture and change its boundary to 'x'. Note that the boundary of the picture consists of 1s connected to and adjacent to 0s. Provide a method to identify and modify these boundaries.
Example
Input
[[0, 0, 0, 1, 0], [0, 1, 1, 1, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0]]