
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use DFS two times.
For the first time, find the sum of values of all the levels of the binary tree.
For the second time, update the value of the node with the sum of the values of the current level - sibling node’s values.