This question evaluates competency in combinatorial optimization and constrained resource-allocation algorithms, along with analysis of time and space complexity and robustness to skewed input distributions and edge cases.
You're given counts of items by color; each outfit must contain exactly 3 items, all of distinct colors. You cannot reuse items. Input formats: either an array counts where counts[i] is the number of items of color i (0-indexed), or a multiset of color labels (e.g., ['red','red','blue','green',...]). Tasks: