Leetcode 142. Linked List Cycle II

Input: head = [3,2,0,-4], pos = 1
Output: tail connects to node index 1
Explanation: There is a cycle in the linked list, where tail connects to the second node.
Input: head = [1,2], pos = 0
Output: tail connects to node index 0
Explanation: There is a cycle in the linked list, where tail connects to the first node.
Input: head = [1], pos = -1
Output: no cycle
Explanation: There is no cycle in the linked list.

--

--

--

CS new grad, 6 years experience related to supply chain management. Located in Bay area

Love podcasts or audiobooks? Learn on the go with our new app.

Why I Never Use “:ls” In Vim

SPIFFE/SPIRE move to CNCF Incubation-level hosted projects!

Week 6 Reflection: Questions from Your Friends & Tagline Challenge

What makes you a Software Engineer? Not a Software Developer!

I NSAttribute my success to a good night’s sleep and a beer heavy diet

Learn About Retworkx —  The Graph Library Used by Qiskit —  And How to Contribute

Why you should have many AWS account(s)!

Software Developer in Test: Dropping Regression Testing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gary Chiang

Gary Chiang

CS new grad, 6 years experience related to supply chain management. Located in Bay area

More from Medium

Leetcode — anagram

Linked List — Doubly

Some important points regarding Array Data Structure During Placement Interview

[Leetcode] Container With Most Water