Amazon Interview Question

Number of Islands variation leetcode