I am getting two run time errors

@sharmarachit19962000
Your first base case conditions are in the opposite order.
Write it like this

if(head==NULL || head->next==NULL)

@tarunluthra bro can u explain the time appor. timecomplexity when too loops are using here
https://ide.codingblocks.com/s/310945
when the cycle is detected and removed

@Vikaspal
It seems to be O(n) only.

@tarunluthra okay thanks

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.