arrow_back Back to Challenges

#141 Linked List Cycle

Easy Acceptance 0%
description

Problem Description

Given `head`, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next` pointer.

checklist Constraints

The number of the nodes in the list is in the range [0, 10^4].
-10^5 <= Node.val <= 10^5

science Examples

Case #1

In: head = [3,2,0,-4] pos = 1
Out: true

Case #2

In: head = [1,2] pos = 0
Out: true

Mastery Tags

Linked List Two Pointers

Hiring Companies

Amazon Bloomberg Microsoft
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude