Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
chained solution in Clear category for Count Chains by MrPod
def count_chains(c):
v=lambda a:{(x,y,z)for x,y,z in al if(d:=((a[0]-x)**2+(a[1]-y)**2)**.5)abs(z-a[2])}
n=len(c)-len(al:={*c})
while al:
t=v(al.pop())
while t:
t|=v(a:=t.pop())
al-={a}
n+=1
return n
Feb. 27, 2020
Comments: