
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Don't think too much, this is an easy problem. Take some small tree as an example.
Can a parent node use the values of its child nodes? How will you implement it?
May be recursion and tree traversal can help you in implementing.
What about postorder traversal, using values of left and right childs?