Have I done it correctly?
I just compared for duplicates
Circular linked list
Hello @dsingh200021,
Yes, it would work correctly and you can follow this to solve this problem.
In case you want to try the approach explained in the video, then you have to create a cycle in your list.
For this you can:
- keep track of duplicates.
- if a duplicate is detected, then make the next of previous node to point to the node containing the first occurrence of that duplicate value.
- This way, you would have a cycle in your linked list.
Now, try the approach specified in the video.