You are viewing a single comment's thread. Return to all comments →
def countTriplets(arr, r): res = 0 d = {x: [0, 0] for x in arr} for e in arr: a = e / r b = a / r if b in d: res += d[b][1] if a in d: d[a][1] += d[a][0] d[e][0] += 1 return res
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 →