public ListNode getIntersectionNode2(ListNode headA, ListNode headB) {
        ListNode pa = headA, pb = headB;
        int lenA = 0, lenB = 0;
        while (pa != null) {
            ++lenA;
            pa = pa.next;
        }
        while (pb != null) {
            ++lenB;
            pb = pb.next;
        }
        pa = headA; pb = headB;
        int diff = lenA - lenB;
        while (diff != 0) {
            if (diff > 0) {
                --diff;
                pa = pa.next;
            } else {
                ++diff;
                pb = pb.next;
            }
        }
        while (pa != pb) {
            pa = pa.next;
            pb = pb.next;
        }
        return pa;
    }