LeetCode
Friend Circles
Click
here
for an explanation.