Pregunta de entrevista de Microsoft

Num of Islands Leetcode variation, Object oriented programming question