Problem in creating a cycle inside linked list

i am not able to create a loop inside a linked list for e.g.
if the input is 1 2 3 4 5 2 3 -1 then i am having a problem in modifying the linked list so it contains a loop i.e. i don’t know
how to make 5 point back to 2.

@ANIKET_DALAL
hello Aniket,
For general case check this->https://www.geeksforgeeks.org/make-loop-k-th-position-linked-list/

or (assuming all nodes value are unique) u can use hashmap to store value and corresponding address of the node