You are viewing a single comment's thread. Return to all comments →
Or minify it even more:
return arr.reduce( ([dict, count], val) => { !dict[val] && (dict[val] = [0, 0, 0]); !dict[val * r] && (dict[val * r] = [0, 0, 0]); count += dict[val][2]; dict[val * r][1] += 1; dict[val * r][2] += dict[val * r][1]; return[dict, count]; }, [{}, 0] )[1];
Seems like cookies are disabled on this browser, please enable them to open this website
Count Triplets
You are viewing a single comment's thread. Return to all comments →
Or minify it even more: