Exercise: Calculating the Size of a Tree

Challenge yourself with an exercise in which you'll have to calculate the size of a binary tree!

We'll cover the following

Problem

The size of the tree is the total number of nodes in a tree. You are required to return the size of a binary tree given the root node of the tree.

Below is an example illustrated for you:

Get hands-on with 1200+ tech skills courses.