Linked List Cycle (LC-0141)
class Solution:
def hasCycle(self, head):
slow = fast = head
started = True
while fast and fast.next:
if not started and fast == slow:
return True
started = False
slow = slow.next
fast = fast.next.next
return False