Domanda di colloquio di Microsoft

A 2d array question about connected islands.