• + 0 comments

    Recursive solution doesn't work on Python because of the maximum recursion limit (e.g. Test 11 has a tree with 72000 depth). sys.setrecursionlimit(100000) doesn't work because Python still crashes at ~2670 level of recursion. What works: using Kahn's algorithm to iteratively go from the leaves to the root. New style Prescription wooden glasses