非常巧妙先让指针分别循环两个链表到结尾时在2指向对方链表继续循环当指针指向同一结点就是相交节点/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val x; * next null; * } * } */ public class Solution { public ListNode getIntersectionNode(ListNode headA, ListNode headB) { ListNode A headA; ListNode B headB; while(A ! B){ A A null ? headB : A.next; B B null ? headA : B.next; } return A; } }