Circular Linked list

One test case is not running .
Please tell me what I’m missing in this code.

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.

ur test case fails when tere is a loop at the second last position

ok got it.your way seems correct .
Thank u !

1 Like