Connected components

Company: HiLabs_SDE

Difficulty: medium