I would like a clarification for the challenge

If I am understanding the question correctly, shouldn’t pairwise([0,0,0,0,1,1]) return 4 (Only combination is 0 + 1, and the smallest sum of indices is 0 + 4 = 4), rather than 10?

Pairwise challenge

0

I would like a clarification for the challenge

If I am understanding the question correctly, shouldn’t pairwise([0,0,0,0,1,1]) return 4 (Only combination is 0 + 1, and the smallest sum of indices is 0 + 4 = 4), rather than 10?

1 Like

You are right, it is kinda confusing how they put it, but by “return the smallest sum of indices.” what they mean is not the sum of the indexes of the smallest index pair, but rather the sum of all the index pairs indexes. (wow, that was an awkward sentence) so, in the case of your example, what they are looking for with `pairwise([0, 0, 0, 0, 1, 1], 1)`

you have two solutions:

`Array[0] + Array[4]`

and `Array[1] + Array[5]`

what they are looking for is the sum of those two: `(0 + 4) + (1 + 5)`

thus 10.

3 Likes

I have noticed your activity on the forum and it has been very helpful and detailed. Thanks for helping others out and happy coding my friend

1 Like

Thank you. I like helping people. And teaching also helps me to solidify it more in my own mind. On top of that, it makes me feel useful when I’m having a little “coders block” on my own project.

1 Like