Linked List Cycle
Problem
Input: head = [3,2,0,-4], pos = 1 Output: true Explanation: There is a cycle in the linked list, where the tail connects to the 1st node (0-indexed).Input: head = [1,2], pos = 0 Output: true Explanation: There is a cycle in the linked list, where the tail connects to the 0th node.Input: head = [1], pos = -1 Output: false Explanation: There is no cycle in the linked list.
Pseudocode
Solution
Time and Space Complexity
Time
Space
Last updated


