Algorithm · Databricks · Hard
Problem Overview You receive n already-connected node components, referred to here as groups. For instance: Nodes within any one group already have paths between them. Create a function that returns additional edges so that all groups together form one connected graph after those edges are inserted. The output has to meet both conditions below: It must contain as few edges as possible. Joining k separate groups requires precisely k - 1 added edges. It must be drawn uniformly…
Checking your access…