Challenge: Number of Full Nodes in a Binary Tree

Let’s count the number of full nodes in a binary tree.

Problem

Given a binary tree, find the count of full nodes in it. A full node has non-null left and right children.

Input

A binary tree.

Output

The number of full nodes.

Sample input

Get hands-on with 1400+ tech skills courses.