The depth is being increased by 2 the parents are not changing.
Code is not wokring
hello can u Elaborate ur doubt or u can call me on 8368547890
Yes, I modified the dfs function so that it also provides the distance from the root node. But after doing that the depth for every node is increasing by two for example it goes from 2 to 4 to 6. And also when i modified the parent array it stopped working and is assigning every node as its own parent.
The same functions when i used for lca were working fine.
check ur inbox…
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.