Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Mountain Scape solution in Speedy category for Mountain Scape by vinc
def mountain_scape(tops):
all_triangles = set()
queue = set(tops)
while queue:
x, y = queue.pop()
all_triangles.add((x, y))
if y == 1:
continue
if (x - 1, y - 1) not in all_triangles:
queue.add((x - 1, y - 1))
if (x + 1, y - 1) not in all_triangles:
queue.add((x + 1, y - 1))
return sum(1 if y == 1 else 2 for x, y in all_triangles)
Nov. 14, 2020