/**
* 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) {
//思路:走完A走B 走完B走A 当两个链表指向相同元素的时候
//就是相交的节点. 否则就指向空
ListNode h1 = headA;
ListNode h2 = headB;
while(h1 != h2){
h1 = h1 ==null ? headB : h1.next ;
h2 = h2 == null ? headA : h2.next;
}
return h1;
}
}
12-06
1237

11-29
886

05-14
803

05-14
805

05-16
423
