Pls look into this the code is not working


pls look into this there is always segmentation fault.
Tell me the error

@Madhavendra-Gupta-2240591552663161 Your code is going in infinite loop. You have assumed that the cycle is formed at head, which is not the case.
Cycle can be like 1 2 3 4 5 6 7 4
as you can see cycle is 4 5 7 4
in this case your n pointer will never come back to head and it will keep moving.
To solve this you need to use fast pointer slow pointer technique. (You have written the code for the same in a function, i have not checked that function though).
If this solves your doubt mark it as resolved.

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.