Challenge: Find Number of Leaf Nodes

Let’s find the number of leaf nodes present in a binary tree using recursion.


Given a binary tree, find the total number of leaf nodes it has.


A binary tree.


The total number of leaf nodes.

Sample input

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.