Amazon interview question

Number of islands (problem on leetcode)