Failing private test cases

All test cases are failing. Only the sample test cases are passing.

Refer for code: -

hey ambuj,
In this we have to call dfs_helper from the smallest node i.e. master node
for that you cannot use map because in that no order is maintained.
This was the only problem.


I corrected in your code.
Please let me know if there is any other doubt.

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.