Skip to content

Latest commit

 

History

History

Number of Nodes at Given Level

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given a tree represented as undirected graph. Count the number of nodes at given level l. It may be assumed that vertex 0 is root of the tree.

Input :   7
          0 1
          0 2
          1 3
          1 4 
          1 5
          2 6
          2
Output :  4

Input : 6
        0 1
        0 2
        1 3
        2 4
        2 5
        2
Output : 3