The Pairwise Algorithm Challenge

function pairwise(arr, arg) {
  return arr.reduce(function(sum,cur,i,ar){
        for(var j=i+1;j<ar.length;j++){
          if(cur+ ar[j]=== arg){
             sum+=i+j;
            ar[j]=' ';
             break;
          }
      }

return sum;

},0);
}

2 Likes