剑指offer python版 链表中环的入口结点
class Solution: def EntryNodeOfLoop(self, pHead): pFast = pHead pSlow = pHead while pFast != None and pFast.next != None: pFast = pFast.next.next pSlow = pSlow.next if pFast == pSlow: break if pFast == None or pFast.next == None: return None pFast = pHead while (pFast != pSlow): pFast = pFast.next pSlow = pSlow.next return pFast # write code here