Cycle detection and removal code

hi team,

i am facing trouble that only 60-70% of the test cases are getting passed for the code… rest all are giving run time error,
could you please check what caused the issue.
link in the next comment

i have added some corner cases
now it passed all testcases

check now
Modified code

i hope your doubt is resolved
if not feel free to ask

awesome, thanks buddy :slight_smile:

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.