You are viewing a single comment's thread. Return to all comments →
def countTriplets(arr, r): count = 0 elements = set(arr) for i in elements: first = i second = i*r third = i*r*r if (second in elements) and (third in elements): count += arr.count(first) * arr.count(second) * arr.count(third) return count
i am facing an errorwhen r = 1. could someone please help me with it
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 →
i am facing an errorwhen r = 1. could someone please help me with it