You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/findDisappearedNumbers/index.js)| Easy |
|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/maxProfit/index.js)| Easy |
15
-
|[Range Sum Query - Immutable](https://leetcode.com/problems/range-sum-query-immutable)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/sumRange/index.js)| Easy |
|[Linked List Cycle](https://leetcode.com/problems/linked-list-cycle)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/hasCycle/index.js)| Easy |
18
-
|[Middle of the Linked List](https://leetcode.com/problems/middle-of-the-linked-list)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/middleNode/index.js)| Easy |
|[Running Sum of 1d Array](https://leetcode.com/problems/running-sum-of-1d-array/)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/runningSum/index.js)| Easy |
|[Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/findDisappearedNumbers/index.js)| Easy |
|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/maxProfit/index.js)| Easy |
15
+
|[Range Sum Query - Immutable](https://leetcode.com/problems/range-sum-query-immutable)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/sumRange/index.js)| Easy |
|[Linked List Cycle](https://leetcode.com/problems/linked-list-cycle)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/hasCycle/index.js)| Easy |
18
+
|[Middle of the Linked List](https://leetcode.com/problems/middle-of-the-linked-list)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/middleNode/index.js)| Easy |
|[Running Sum of 1d Array](https://leetcode.com/problems/running-sum-of-1d-array/)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/runningSum/index.js)| Easy |
|[Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii/description/)|[Solution](https://github.com/GolubevDS/LeetCodePatterns/blob/main/solutions/detectCycle/detectCycle.js)| Medium |
## [142. Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii/description/)
2
+
3
+
Given the `head` of a linked list, return the node where the cycle begins. If there is no cycle, return `null`.
4
+
5
+
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. Internally, `pos` is used to denote the index of the node that tail's `next` pointer is connected to (0-indexed). It is `-1` if there is no cycle. Note that `pos` is not passed as a parameter.
0 commit comments