not detecting cycle ???
What is the mistake in code ??
Cycle detection
You just keep taking inputs in the same manner as you did in the others(i.e. insertion at the tail) until you get an element which is already present in the list , in such case you need to check wheather the further elements are same if yess then point the last node to the matching node , else keep taking input …
just store alll the elements and start traversing the list until u get the element which has already occurred before.
https://ide.codingblocks.com/#/s/17565
https://hack.codingblocks.com/app/contests/1281/1307/problem
try this question its more apt for ur code
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.