Algorithm · Oracle · Medium
You are given a rectangular binary matrix grid in which every cell holds a 0 (water) or 1 (land). A group of land cells forms an island if each cell can be reached from any other cell in the group by moving only horizontally or vertically — diagonal neighbours do not connect. An island is maximal: it includes every land cell reachable under these rules. Write a function that accepts the grid and produces an integer array of length two: [total_islands, largest_island_size].…
Checking your access…