Circular linked list

Have I done it correctly?


I just compared for duplicates

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:

  1. keep track of duplicates.
  2. 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.
  3. This way, you would have a cycle in your linked list.
    Now, try the approach specified in the video.