Leetcode: Given a list, find whether cycle is present in the list.

The problem can be solved by having slow and fast pointer. Increment slow pointer once and increment fast pointer twice. Check whether the node at slow and fast pointer is same. If the value is same, return true or continue unless end of list is present.

The LinkedList for the example is singly. Here is how Node class looks like: