• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 01, 2023 |1.4K Views
Number of leaf nodes
Description
Discussion

In this video, we will discuss the problem to count the number of leaf nodes in a binary tree. 

For example: 

Input:
For the below-given tree is 
              4
            /   \
           8     10
          /     /   \
         7     5     1
        /
       3 
Output: 3
Explanation: The three leaves are 3, 5, and 1.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article:  https://www.geeksforgeeks.org/write-a-c-program-to-get-count-of-leaf-nodes-in-a-binary-tree/
Problem: https://practice.geeksforgeeks.org/problems/count-leaves-in-binary-tree/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More