Amazon Interview Question

Islands problem that can be found on leetcode