题解 | #链表中环的入口结点#
链表中环的入口结点
http://www.nowcoder.com/practice/253d2c59ec3e4bc68da16833f79a38e4
class Solution:
def EntryNodeOfLoop(self, pHead):
# write code here
if not pHead: return None
mark=set()
curr=pHead
while curr:
if curr in mark: return curr
else: mark.add(curr)
curr=curr.next
return None
题解-数据结构与算法 文章被收录于专栏
小菜鸟的题解