Challenge: Sum of All Nodes in a Binary Tree

Let’s calculate the sum of the values present in the binary tree.

Problem

Given a binary tree, find the sum of values of all its nodes.

Input

A binary tree.

Output

Sum of values of all the nodes.

Sample input

Get hands-on with 1400+ tech skills courses.