i got the concept of floyd’s cycle but the thing is how do we take the input for checking whether its floyd cycle or not.
Floyd's cycle concept
hello @gulatigarvita08
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 .
if u only want to practice alogorithm then submit it here I/O part is already handled->
https://hack.codingblocks.com/app/contests/1350/1307/problem?_ga=2.96945119.1782655618.1591451583-1237595310.1591451583
1 Like
what is visited array? and i haven’t studied maps 
ok then try to code only alogritm part and submit the code at above shared link
1 Like
ok … thank you so much…