Easy · Graphs · about 10 minutes
Asked at Google, Amazon, Apple, Oracle, Bloomberg, Morgan Stanley.
A grid has exactly one island (4-directionally connected 1s, no lakes inside). Return its perimeter.