Answers for "beautiful triplets hackerrank solution in python"

0

beautiful triplets hackerrank solution in python

def beautifulTriplets(d, arr):
    a = set(arr)
    return len([1 for i in arr if i+d in a and i+d*2 in a])
n,d = map(int,input().split())
arr = list(map(int,input().split()))
print(beautifulTriplets(d, arr))
Posted by: Guest on April-09-2021

Code answers related to "beautiful triplets hackerrank solution in python"

Python Answers by Framework

Browse Popular Code Answers by Language