I used the Floyd Algorithm, still it shows TLE and even run error in some cases. 2 of the cases show right answer. Please check. Here’s the code
Run Error And TLE in Many cases
hello @Doctor_Insult
![]()
u missed this condition.
also slow and fast will again meet at starting of the cycle.
so first detect the meeting point of cycle .
then reinitialise slow with head.
and while slow->next!=fast->next)
increment both pointer by one.
then do fast->next=NULL;
Thanks. Will try it and let you know!