Microsoft interview question

A 2d array question about connected islands.