Circular Linked List(Detect and Remove loop)


Gives
/bin/run.sh: line 4: 18 Segmentation fault (core dumped) ./exe
error

@adeebkan0671 one modification you have to do while taking input is when values start repeating you have to link the node to its previous value.
like:- 1 2 3 2 -1 => here the list will be 1 2 3.
so make a map<int, node *> and check it for every value. like here when 2 occurs after 3 then just map to 3 to ‘2’ which occured previously.

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.