Skip to content

#141 - Linked List Cycle

EasyLinked List
Open on LeetCode

Given head, the head of a linked list, determine if the linked list has a cycle in it. A cycle exists if some node can be reached again by continuously following next. Return true if there is a cycle, false otherwise.

InputOutput
head = [3,2,0,-4], tail connects to index 1true
head = [1,2], tail connects to index 0true
head = [1], no cyclefalse

Released under the MIT License.