The rules for the front-end development’s advanced algorithm scripting problem “Pairwise” state:
If multiple pairs are possible that have the same numeric elements but different indices, return the smallest sum of indices. Once an element has been used, it cannot be reused to pair with another.
But one of the examples states: pairwise([0, 0, 0, 0, 1, 1], 1) should return 10, which contradicts the above bolded statement. If, when presented with pairs that have the same numeric elements but different indices, you’re only supposed to keep the pair with the smallest sum of indices, then you would only keep the pair [0,1] from indices 0 and 4 and discard the pair [0,1] from indices 1 and 5. This would leave you with a single pair whose indices sum to 4.