142. Linked List Cycle II
Similiar problem:141. Linked List Cycle
Given a linked list, return the node where the cycle begins. If there is no cycle, return null
.
Note: Do not modify the linked list.
Follow up:
Can you solve it without using extra space?
真的不懂..
参考:http://www.cnblogs.com/abc-begin/p/7666817.html
https://blog.csdn.net/willduan1/article/details/50938210
先看160题吧!
160. Intersection of Two Linked Lists
题外话:如果想计算环的大小,怎么算?解:第一步,判断是否有环,即让快慢指针相遇,记为c点,从c点开始,让慢指针行走(此时快指针固定在c点,等候慢指针),直到快慢指针相遇,此时慢指针行走的步数就是环的大小。