Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Evenly spaced code solution in Clear category for Evenly Spaced Trees by veky
import operator, functools, math
def evenly_spaced_trees(trees):
spaces = [*map(operator.sub, trees[1:], trees)]
delta = functools.reduce(math.gcd, spaces)
return sum(d // delta - 1 for d in spaces)
April 4, 2019
Comments: