easyFast & Slow Pointers Pattern

Linked List Cycle

Given `head`, the head of a linked list, determine if the linked list has a cycle in it. Return `true` if there is a cycle, otherwise return `false`.

Examples

Input:head = [3,2,0,-4], pos = 1
Output:true

Explanation: There is a cycle where tail connects to the 1st node (0-indexed).

Hints (0/2)

Try to solve it first! Click "Reveal Next Hint" if you get stuck.

Your Code:
Results:
Output

Click "Run" to execute your code