Reported interview periodApr 2026–May 2026
Uniform Random Connection Across Node Groups
Given disjoint non-empty groups of node IDs, treat each group as an internally connected component. Generate a random set of additional edges connecting all groups, never joining two nodes from the same group. …
Practice focusRequirements - Return exactly len(groups) - 1 edges when there is more than one group. - Each edge joins nodes from different groups, and all groups become connected. - Use the supplied seed for reproducibility. - Store each edge with the smaller node ID first and return edges in sorted order. - Duplicate node IDs across groups are invalid. - Node IDs are non-boolean integers and seed is a non-boolean integer. Empty input returns [] ; empty groups, duplicate IDs within or across groups and invalid IDs/seeds raise ValueError before sampling.…