Feb 12, 2021

In your test case, which is the same I wrote about, there are two complete pairs: one pair of type 1, and one pair of type 2. There is a remainder sock of types 1 and 3. And that’s what the algorithm correctly outputs: 2 pairs of socks.

Where does your confusion lie?