Loading...
Loading...
Loading...
Each node of a chart stores the sales of one team, which may be negative after refunds. Print the total over all nodes.
Example 1
Input
5 3 8 1 4 7 9
Output
37
5 + 3 + 8 + 1 + 4 + 7 + 9 = 37.
Example 2
Input
null
Output
0
Try the problem first. Open one hint at a time.
The sum of a missing child is 0.
Add the node's value to the sums of the two sides.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor