You are viewing a single comment's thread. Return to all comments →
If the head can be converted to JSON without an error being thrown, there are no cycles.
head
function hasCycle(head) { try { JSON.stringify(head) return 0; } catch(err) { return 1; } }
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 →
If the
head
can be converted to JSON without an error being thrown, there are no cycles.