We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
i've got another way:
run a counter variable (k) to count the no. of nodes we have transversed in the linked list and
if any node in the linked list points NULL (while k<100) then the list surely does not contain any cycle.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
i've got another way: run a counter variable (k) to count the no. of nodes we have transversed in the linked list and if any node in the linked list points NULL (while k<100) then the list surely does not contain any cycle.