Back to problems

Constrain Every Five Consecutive Array Elements to Be Unique

Algorithm · Apple · Medium

Five-Element Distinct Window Constraint Medium · Topics · Company Tags · Hints Implement a SystemVerilog constraint for a dynamic integer array arr whose elements are randomized. The constraint must ensure that every sliding window of exactly five consecutive positions contains only distinct values. If arr.size() is less than 5, the constraint adds no special uniqueness requirements. When arr.size() is 5 or larger, for every start index i where 0 <= i <= arr.size() - 5, the…

Checking your access…