How to take input in link list with cycles?

How to take input in a Link list with loops or cycles ?

Could not understand the problem statement and sample input

rachit make a array if the same number has come which also come previously then u didnt insert that number in ll

This code shows “error”


i have commented what u have to do and what is ur mistake

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.