DescriptionQ759
Q759DVASIC interview problem
Partition a randomized parent array
TechniquesRandomizationpost_randomize
DifficultyMedium
TopicConstraints
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Randomize a unique five-element parent array, choose three non-empty child sizes that sum to five, then partition the parent elements among the children.
Example input and output
Use this case to check your interpretationInput
parent=[0,1,2,3,4]; randomized child sizes=[1,2,2]Output
child1=[0], child2=[1,2], child3=[3,4]Explanation
A monotonically increasing source index slices contiguous segments and consumes every parent element exactly once.
02
Requirements (3)
- Each child size must be between 1 and 4.
- Every parent element must appear in exactly one child.
- Create and populate child arrays in post_randomize.
