Pergunta de entrevista da empresa Microsoft

Num of Islands Leetcode variation, Object oriented programming question