You are viewing a single comment's thread. Return to all comments →
import bisect def triplets(a, b, c): count = 0 a = list(set(a)) b = list(set(b)) c = list(set(c)) a.sort() b.sort() c.sort() for element in b: c1 = bisect.bisect(a,element) c2 = bisect.bisect(c,element) count += c1*c2 return count
Seems like cookies are disabled on this browser, please enable them to open this website
Triple sum
You are viewing a single comment's thread. Return to all comments →
O(nlogn) Solution