Pattern
Constrained Frequency Construction
constrained-frequency-construction
Frequency constraints on a multiset (per-value occurrence caps and allowable extremes) make the target list length depend on which values must be excluded, so greedy counting silently limits achievable maxima.