Cvent Interview Question

How to know if a linked list has cycle?

Interview Answer

Anonymous

Mar 2, 2017

starting from the head node, traverse, if you encounter the head node again then it's a circle? Not sure about whether there can be an identical node on the middle. if so, store the first k elements you see on an array and check whether you'd see the same pattern again (k would be a "secure" number of nodes, i bet you've got my point)