Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple simulation solution in Clear category for Toothpicks by StefanPochmann
from collections import Counter
def toothpicks(step: int) -> int:
Z = {(0, 0)}
for _ in range(step - 1):
c = Counter(
(z + 1j**(d+e), 1-d)
for z, d in Z
for e in [0, 2]
)
Z |= {k for k, v in c.items() if v == 1}
return len(Z)
March 15, 2023