3879. Maximum Distinct Path Sum in a Binary Tree
Hash TableTreeDepth-First SearchBinary Tree
Hints
Hint 1
Try all possible starting nodes
Hint 2
For a given node, the possible outgoing edges are the left child, right child, and parent
Hint 3
During depth first search (DFS), only visit a node if its value has not already been seen
Hint 4
Take the maximum over all possible starting nodes
Preparing judge…