Linked List – Detect a Cycle

I spent a considerable amount of time over the weekend experimenting with this easy challenge from HackerRank. If interested you can get to the challenge using the following URL: https://www.hackerrank.com/challenges/ctci-linked-list-cycle

For starters, the first element in the list is also the head. This is not a good idea. The reason is that if the head changes references to the list are lost. This might be OK for trivial examples, but in real life a list may be referenced by different threads. Continue reading “Linked List – Detect a Cycle”