After marking endpoints and LCA for all paths, run a DFS to propagate counts upward. Each node's count is: its own mark plus the sum of its children's counts. This works because the marking scheme in the previous unit ensures that counts accumulate correctly as you go up the tree. Increments at path endpoints bubble up, and decrements at the LCA stop them at the right level.
The DFS is a standard post-order traversal: visit children first, then process the current node. Time: O(n) because you visit each node once. This two-phase approach (mark, then propagate) is a common pattern for tree path queries. You will see it again in other problems.