DescriptionQ830
Q830DVASIC interview problem
Constrain three disjoint child arrays
TechniquesRandomizationConstraintsSet membership
DifficultyMedium
TopicConstraints
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Randomize a unique five-element parent array and three non-empty child arrays whose union equals the parent with no overlap.
Example input and output
Use this case to check your interpretationInput
randomize three children drawn from parent=[10,11,12,13,14]Output
One valid result: a=[10], b=[11,13], c=[12,14]Explanation
The children are pairwise disjoint and contain only parent values; many other random partitions satisfy the same constraints.
02
Requirements (3)
- Child sizes must sum to the parent size.
- Every child element must come from the parent.
- Children must be pairwise disjoint and individually unique.
