Print List of nodes of given n-ary Tree with number of children in range [0, n]
Given an n-ary Tree having N nodes numbered from 1 to N, the task is to print a list of nodes containing 0, 1, 2, 3, . . ., n children. Note: An n-ary Tree is a tree in which nodes can have at most n children. Examples: Input: Output: 0 child: 3, 5, 6, 71 child: 42 child: 23 child: 1 Input: Output: 0 child: 15, 30, 40, 99, 22, 46, 56, 25, 901 child