Back to problems

Maximize outfits with distinct colors

Algorithm · Point72 · Hard

You are supplied with items, each carrying a color label. A single outfit is made of exactly three items, and the three colors involved must all be different; an item is consumed once it is placed in an outfit and can never be reused. Input may arrive in one of two forms: an array counts where counts[i] gives the tally of items for color i (colors indexed from 0), or a multiset of raw color labels such as ['red','red','blue','green'] whose per-color tallies are implied.…

Checking your access…