• + 0 comments
    for i in arr:
        if i+d in c and i+2*d in c:
            c+=1
    return c
    

    This also