You are viewing a single comment's thread. Return to all comments →
I got this:
boolean hasCycle(Node head) { if (next == null) return false; if (next == head) return true; else { if (head.next != null && next.next != null) { return next.next.hasCycle(head.next); } else { return false; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
I got this: