You are viewing a single comment's thread. Return to all comments →
def beautifulTriplets(d, arr): # Write your code here list2=[] for i in arr: list1=[] a=i for j in arr[1:]: if len(list1)<3: if j-a==d: if a not in list1: list1.append(a) list1.append(j) a=j if len(list1)==3: list2.append(list1) # print(list2) return len(list2)
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Triplets
You are viewing a single comment's thread. Return to all comments →