Algoritim Pairwise Help - How to get indices of duplicate elements

I can not sum indexes of array for the case pairwise( [1,1,1],2). Because indexOf() method only returns first duplicate element indice so I am getting sum of index is 0. How can I solve it?

That’s the challenge :wink:

1 Like