Initialize the number of children as 0.
For every node in the n-ary tree, check if its value is equal to x or not. If yes, then return the number of children.
If the value of x is not equal to the current node then, push all the children of current node in the queue.
Keep Repeating the above step until the queue becomes empty.
Number of children of given node in n-ary Tree: https://www.geeksforgeeks.org/number-children-given-node-n-ary-tree/