sir i’m nit able to think how to approach this question
can u please discuss your thought process how to approach such questions as according to me every node can be root
KIngdom partition
@rahul_prashar
It is a simple dfs question
For each node calculate number of nodes below it
Let it be X
then add pair <N-X,X-1> to a vector
Finally keep only unique pairs in this vector
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.