X interview question

Question with finding islands within nested arrays