Approach hintTry it first, then revealHide
Pass the maximum value on the path from the root as a DFS parameter; a node is good when its value is at least that maximum.
Pass the maximum value on the path from the root as a DFS parameter; a node is good when its value is at least that maximum.