Unique 3D Array
Generate a unique 3D array
Unique 3D Array
Problem Statement
Given a 3×3×3 three-dimensional array, generate an array where all 27 values are unique integers in the range 1, 100.
This tests constraint generation for multi-dimensional arrays and the unique constraint in SystemVerilog.
Constraints
- Array dimensions: 3×3×3 (27 elements total)
- Each element: 1 ≤ element ≤ 100
- All elements: Must be unique (no duplicates)
Examples
Example 1:
Generate a 3×3×3 array with all unique values in [1,100]
One valid solution:
Layer 0: [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
Layer 1: [[10, 11, 12],
[13, 14, 15],
[16, 17, 18]]
Layer 2: [[19, 20, 21],
[22, 23, 24],
[25, 26, 27]]
Explanation: All 27 values are unique and in range [1,100]Example 2:
Output:
Layer 0: [[50, 45, 100],
[23, 67, 12],
[89, 34, 56]]
Layer 1: [[72, 11, 98],
[44, 29, 75],
[3, 88, 61]]
Layer 2: [[91, 15, 42],
[77, 33, 59],
[24, 70, 8]]
Explanation: Random unique values, still satisfies the constraintLoading the interactive workspace...