26: Linked list cycle
Given a linked list
, check if it has a circle
in it or not
Example 1
Input: Node1 -> Node2 -> Node3
Output: false
Example 2
Input: Node1 -> Node2 -> Node3 -> Node4 -> Node2
Output: true
Helpful article
Given a linked list
, check if it has a circle
in it or not
Example 1
Input: Node1 -> Node2 -> Node3
Output: false
Example 2
Input: Node1 -> Node2 -> Node3 -> Node4 -> Node2
Output: true