📌  相关文章
📜  python代码示例中漂亮的三胞胎hackerrank解决方案

📅  最后修改于: 2022-03-11 14:46:56.726000             🧑  作者: Mango

代码示例1
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))