一个链表中包含环,请找出该链表的环的入口结点

方法一、用HashSet来解决 1 public ListNode EntryNodeOfLoop(ListNode pHead){ 2 HashSet<ListNode> hs = new HashSet<ListNode>(); 3 while(pHead!=null){ 4 if(!hs.add(pHead))//如果包含了,那么这个就
相关文章
相关标签/搜索