Dashing through Leetcode problems, I found this one: Linked List Cycle. In this blog, I’ll solve it using the two-pointer approach.

Our task is to determine if the linked list has a cycle in it. Return true if there is a cycle in the linked list. Otherwise, return false.

What is considered to be a cycle? There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Have a look at this example.

#javascript

Linked List Cycle: Solved
1.10 GEEK