Fi Money interview question

The question was around Disjoint set data structure