GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.hackerrank.com — Linked Lists: Detect a Cycle | HackerRank 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. A linked list is said to contain a cycle if any node is visited more than once while traversing the list. For example, in the following graph there is a cycle formed when node points back to node .
Function Description Complete the function has_cycle in the editor below. It must return a boolean true if the graph contains a cycle, or false. has_cycle has the following parameter(s):
Returns
Note: If the list is empty, will be null. Input Format There is no input for this challenge. A random linked list is generated at runtime and passed to your function. Constraints Sample Input The following linked lists are passed as arguments to your function:
Sample Output Explanation
Cookie support is required to access HackerRankSeems like cookies are disabled on this browser, please enable them to open this website |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |