Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
1 Line Solution, How NOT to Write Code solution in Creative category for Domino Chain by master3243
domino_chain = lambda tiles, start=None: 1 if not tiles else domino_chain([(i[0], i[2]) for i in tiles.split(', ')], start='-')//2 if not start or not tiles else sum(domino_chain(tiles[:i] + tiles[i+1:], start=n[0]) + domino_chain(tiles[:i] + tiles[i+1:], start=n[1]) if start == '-' and n[0] != n[1] else domino_chain(tiles[:i] + tiles[i+1:], start=n[1]) if start == n[0] or start == '-' else domino_chain(tiles[:i] + tiles[i+1:], start=n[0]) if (n[0] != n[1]) and (start == n[1] or start == '-') else 0 for i, n in enumerate(tiles))
Sept. 5, 2017
Comments: