class Solution(object):
def entryNodeOfLoop(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
slow, fast = head, head
while fast:
slow, fast = slow.next, fast.next
if fast: fast = fast.next
if slow == fast:
slow = head
while fast and slow != fast:
slow, fast = slow.next, fast.next
return fast
return None
不是,你这是暴力解?