Circular Linked List Problem

In the given problem will have to remove cycle but I am confused that how to create a cyclic linked list. I know that I have to used the concept of circular linked list but in the given question starting node is not head. How to do that ??

Is searching required to do this problem, first check that the element is present or not if not then push into linked list otherwise if repeating then making it as head ??

hello @ashwani225
Say If INPUT IS 1 2 3 4 5 2 3 -1
form a linked list 1->2->3->4>5 then you see that 2 has already been visited (So for this you can maintain a map or a visited array…whenever you see that a node is already visited, connect next pointer of previous node to that node.) so connect the next pointer of 5 to 2. This way you have created the circular linked list .

will there be more than 1 repeated value or more ??

i guess there should be only one value which will repeat twice.

if u just want to implemnt cycle detection algorithm then u can try it here -> https://leetcode.com/problems/linked-list-cycle/