class Solution: def EntryNodeOfLoop(self, pHead): # write code here if not pHead: return None start = pHead dic = {} while start: if start in dic: return start else: dic[start] = start.val start = start.next return None
class Solution: def EntryNodeOfLoop(self, pHead): # write code here if not pHead: return None start = pHead dic = {} while start: if start in dic: return start else: dic[start] = start.val start = start.next return None