问题 解答 如果是环形链表,快指针会等于慢指针 时间复杂度:O(n) class Solution(object): def hasCycle(self, head): if not (head and head.next): return False #i为慢指针,j为快指针 i,j = head,head.next while j and j.next: if i==j: return True i,j = i.next, j.next.next return False