Lucid Motors Interview Question

Leetcode- Number of islands question