给一个链表,若其中包含环,请找出该链表的环的入口结点,否则,输出null。
链表中环的入口结点
http://www.nowcoder.com/questionTerminal/253d2c59ec3e4bc68da16833f79a38e4
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
360集团公司福利 429人发布