What's the problem with my approach

It not passing test cases

I have made a few changes in cycle removal part… its working fine now https://ide.codingblocks.com/s/610474

bhai samjha de kya galti ki hai, yaa fir koi example share krde jisme code nhi chal raha. Aise code dekh ke samajh nhi aata

ur code will fail in case say its a circular linked list… ie last node pointing to first node…

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.