Goldman Sachs Interview Question

LC Graph Question (No. Of Connected Islands)