Pairwise question

20 character text here

1 Like

So,
pairwise([0, 0, 0, 0, 1, 1], 1) should return 10.

What I think you’re missing is that you can have more than one pair.

You take the first 0 and the first 1 --> 0+4=4
You take the second 0 and the second 1 --> 1+5=6
Then, 4+6=10

You need to add all sums, and always use first the ones with lower index.

20 character text here

1 Like