The traversals pass a vector down. Max depth passes a number up. Path sum passes a number down and a yes back up.
The same walk over the same tree, six ways. Pick an order and watch ans fill as it is handed down to every call; pick max depth and watch each subtree report a number back to its parent; pick path sum and watch the remaining target shrink on the way down; pick validate BST and watch the allowed range narrow.
Press Next to make the first call.
Switch between the three orders and watch the code panel. The recursion never changes: the same two calls, left then right, in the same place. Only ans.push_back moves — before both calls, between them, or after them. That is Day 1's print 1..N versus N..1 again, with two recursive calls instead of one.
Inorder on the LC 144 tree gives 4 2 6 5 7 1 3 9 8: every value lands after everything in its left subtree and before everything in its right. On a binary search tree that is the sorted order, which LC 98 uses on Thursday.
The traversals return nothing. They get their work done by handing ans down by reference, so every call writes into the same vector. Pass it by value and each call would fill its own copy, thrown away when it returns.
Max depth is the other way round. Nothing goes down; each call waits for its two children to report back, then returns 1 + max(l, r) to its own parent. It is a postorder walk: a node can only answer once both subtrees have.
Top-down passes information to the children. Bottom-up waits for them to answer.
Path sum does both. The remaining target goes down as a parameter — each call subtracts its own value, and every call has its own copy, so nothing is undone on the way back. A true or false comes back up, and || stops the search as soon as one side says yes. Try 22, 26 and 18 on the LC 112 tree (three different leaves), then 9: 5 → 4 adds to 9, but 4 isn't a leaf.
Validate BST passes a whole range down. Going left, the current node becomes the new upper bound; going right, it becomes the new lower bound; the other side is inherited. Pick the BST trap: every parent and child are in order, yet 3 fails, because it arrives at 6's left with the range (5, 6), and it only knows about the 5 because that bound was passed all the way down.
Saturday's LC 543 needs both at once. Each call returns a height, exactly like here, but the diameter it is asked for is a different number, kept on the side and updated as the heights come back.
Every missing child is still a real call: helper(nullptr) runs, hits the base case and returns. A tree of n nodes makes 2n + 1 calls, n + 1 of them on empty subtrees. For max depth those empty calls are where every count starts: each one returns 0, so a leaf gets 1 + max(0, 0) = 1 without any special case.