Referral Count (Subtree Descendant Count in a Referral Tree)
Referral Count (Descendant Count in a Referral Tree)
You are given a referral network where each user (node) has at most one referrer (parent). The relationships form a tree or a forest.
...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
