Problem 142: Linked List Cycle II
思路
开始还是快慢指针的东西
发现有cycle之后(也就是说跳出了第一个while循环),head和slow同时出发,下次,head和slow.next相遇的时候,就是cycle的位置
无他,记住就好了
易错点
判断位置是看 head 和 slow.next 的相遇点
Last updated
开始还是快慢指针的东西
发现有cycle之后(也就是说跳出了第一个while循环),head和slow同时出发,下次,head和slow.next相遇的时候,就是cycle的位置
无他,记住就好了
判断位置是看 head 和 slow.next 的相遇点
Last updated