Friend Circles

There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature.


This is a companion discussion topic for the original entry at https://algo.monster/problems/friend_circles/