Coding Challenge

Linked List Cycle

Easy
linked-listtwo-pointers

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

Preparing your coding workspace...