Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
I found this tool in my Grandpa's attic. solution in Clear category for On the same path by veky
import itertools
def on_same_path(main_tree, pairs):
def visit(tree):
root, subtrees = tree
start = next(step)
for subtree in subtrees: visit(subtree)
span[root] = slice(start, next(step))
step = itertools.count()
span = {}
visit(main_tree)
for a, b in pairs:
yield (span[a].start < span[b].start) == (span[b].stop < span[a].stop)
Jan. 5, 2020
Comments: