https://www.cnblogs.com/bonelee/p/11789330.html 5个模板 """ def hasCycle(self, head): # write your code here slow, fast = head, head while fast and fast.next and fast.next.next: slow = slow.next fast = fast.next.next if slow == fast: return True return False