# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def detectCycle(self, head: ListNode) -> ListNode:
while head is not None:
if head.val is None:
return head
else:
head.val =None
head = head.next
return None
什么玩意
原文:https://www.cnblogs.com/Lzqayx/p/13767809.html