Branch Sum

1 · Maksym Postument · Aug. 23, 2021, 5:49 p.m.
Hello! In this problem, a tree is input and you need to find the sum of all the branches in the tree. The algorithm for solving this problem is simple. Let’s take a tree 6 / \ 4 10 / \ \ 2 5 23 We start from the root, the sum here is 6. Go further down the tree in the left branch it will be 6 + 4 = 10 and in the right 10 + 6 = 16....