codes. Tags with the same code can be clipped together in pairs; each tag belongs to at most one pair.
Clip together as many pairs as possible. Return a two-element array: the number of pairs formed and the number of tags left without a partner.codes=[7, 3, 7, 5, 3, 7] → [2, 2]
Pairs: two 7s and two 3s. The third 7 and the 5 are left over, so the answer is [2, 2].
codes=[0, 0, 0, 0] → [2, 0]
Four equal numbers make two pairs with nothing left.
codes=[12] → [0, 1]
codes=[7, 3, 7, 5, 3, 7]
[2, 2]
Run checks the first 3 tests in your browser. Submit checks all 129 tests on the server, hidden ones included.