Bloomberg Interview Question

Number of islands leetcode question