Notice Period

Largest Outage Zone

medium

A status dashboard shows a grid of monitoring tiles: 1 means the tile is reporting a fault, 0 means healthy. Faulty tiles that touch horizontally or vertically belong to the same outage zone.

Given the integer grid tiles, return the size of the largest outage zone (number of tiles in it). If there are no faults at all, return 0.

Example 1
in tiles = [[1,1,0],[0,1,0],[0,0,1]]
out 3
The connected trio in the top-left beats the lone fault at the bottom-right.
Example 2
in tiles = [[0,0],[0,0]]
out 0
Constraints
  • · 1 <= rows, cols <= 12
  • · tiles[r][c] is 0 or 1
similar problem on LeetCode ↗
solution.pyloading python…
test results
Hit ▶ Run to test your code against the visible cases.