Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for Evenly Spaced Trees by rafal.pawlowski
from typing import List
def evenly_spaced_trees(t: List[int]) -> int:
minimum, maksimum = t[0], t[-1]
diff = maksimum - minimum
st = set(t)
for j in range(diff):
tt = set(range(minimum, maksimum + 1, diff - j))
if not st - tt:
return len(tt) - len(st)
April 24, 2019
Comments: