Hardware interview practice
Constrain three disjoint child arrays
Randomize a unique five-element parent array and three non-empty child arrays whose union equals the parent with no overlap.
Reviewed example
Work through one case
Input
randomize three children drawn from parent=[10,11,12,13,14]Expected output
One valid result: a=[10], b=[11,13], c=[12,14]The children are pairwise disjoint and contain only parent values; many other random partitions satisfy the same constraints.
What to cover
Requirements
- Child sizes must sum to the parent size.
- Every child element must come from the parent.
- Children must be pairwise disjoint and individually unique.
