Zoho Interview Question

Island problem from leetcode platform