I have been studying the Pairwise problem description and looked over the tests and expected results.
I must be missing something, but I can not understand how the following test is valid:
pairwise([0, 0, 0, 0, 1, 1], 1) should return 10
My thinking if I take the first zero (index = 0) and pair it with the 1st one (index 4), the sum should be 4. Even if I chose the 4th zero (index = 3) and pair it with the last zero (index 5), the sum would still only be 8.
Also, the problem description says “Once an element has been used, it cannot be reused to pair with another.” Does “used” mean used in a pair or attempted to use in a pair?
Obviously, I am not understanding the problem description. Any insight would be great.
Thanks,
Randell