Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
3-liner: compact solution in Creative category for Domino Chain by przemyslaw.daniel
f=lambda d,l:sum([f(d[:i]+d[i+1:],j[k])for i,j in enumerate(d)for k
in range(2)if(not l or l==j[(k+1)%2])and(j[0]!=j[1]or k)])+(not d)
domino_chain=lambda t:f([x.split('-')for x in t.split(', ')],'')//2
Sept. 8, 2017
Comments: