双指针模板

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

  

posted @ 2020-03-28 19:58  bonelee  阅读(305)  评论(0编辑  收藏  举报