← 返回 amazon 的题目列表Count Islands and Simulate Rotting Oranges in Grid
类型:online_judge
amazon
Given a 2D grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. Assume all four edges of the grid are surrounded by water. Follow up: Replace [0, 1, 2] for [empty, orange, rotten orange], and simulate how oranges rot. Describe how to solve this.
Example
Input
['11000','11000','00100','00011']