Circular Linked List

Getting Runtime error in test case 1 and 3

Hi @ashishxharma3462
Run error in your code was due the formcycle function. In that you were taking array to keep a track of visited value of linked list instead of that you should take map because some numbers in linked list were making array go out of its limit. If you use map then you will get rid of run time error. Then two of your test case will show wrong ans because in your remove loop function you have not considered that loop might be at head also like 1 2 3 1 2 3 1 2 3 and so on.

I have made these changes in your code. Kindly have a look at it.