You are viewing a single comment's thread. Return to all comments →
C# Solution:
static bool hasCycle(SinglyLinkedListNode head) { List<SinglyLinkedListNode> list = new List<SinglyLinkedListNode>(); while(head!=null) { if (list.Contains(head)) { return true; } else { list.Add(head); head = head.next; } } return false; }
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 →
C# Solution: