Amazon Interview Question

Number of islands leetcode problem