Easy
Detect whether a linked list contains a cycle.
Return true if a linked list has a cycle, otherwise false.
Examples
Input: head = [3,2,0,-4], pos = 1
Output: true
Constraints
- Do not modify the list
Coding Challenge
Detect whether a linked list contains a cycle.
Return true if a linked list has a cycle, otherwise false.
Input: head = [3,2,0,-4], pos = 1
Output: true
Preparing your coding workspace...