News for hackers. Stuff that matters.
Re:The Programming Interview from Hell by twanvl on Monday February 20, 2017 @09:51AM (#13687681)
The standard data structure to look for in this case is the disjoint-set data structure (also called union-find), https://en.wikipedia.org/wiki/Disjoint-set_data_structure. That should make your function fairly easy to implement.
Re:The Programming Interview from Hell by Patient0 on Monday February 20, 2017 @09:54AM (#13687716)
Thanks for that - I'll take a look!