核心思路把其中一条链表按照顺序存入set集合中然后遍历另一条节点如果在集合中存在相同值接返回该节点若不存在返回null完整代码实现ublic class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { SetListNode list new HashSet(); ListNode temp headA; while(temp ! null){ list.add(temp); temp temp.next; } temp headB; while(temp ! null){ if(list.contains(temp)){ return temp; } temp temp.next; } return null; } }