Find the Last Marked Nodes in Tree
Find the two ends of a longest path with two searches; for every node, the farther of those two ends is a last-marked node.
Find the two ends of a longest path with two searches; for every node, the farther of those two ends is a last-marked node.