Amazon interview question

Leetcode 200: Number of Islands