You are viewing a single comment's thread. Return to all comments →
My python code (only runs last for loop if needed):
def beautifulTriplets(d, arr): ans = 0 for a in range(len(arr)): for b in range(a + 1, len(arr)): if arr[b] - arr[a] == d: for c in range(b + 1, len(arr)): if arr[c] - arr[b] == d: ans += 1 return ans
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 →
My python code (only runs last for loop if needed):