Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can we check if any node can be the root?
Can we use this information to check its neighboring nodes?
When we traverse from current node to a neighboring node, how will we update our answer?