You are viewing a single comment's thread. Return to all comments →
Javascript:
function checkCircle(nodes) { const preNodes = []; let node = nodes; do { preNodes.push(node); node = node.next; if (preNodes.some(n => n === node)) { return true; } } while (node !== null) 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 →
Javascript: