Tesla Interview Question

Number of islands leetcode question.