Share my 6-lines java solution

  • 1
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode pa, pb, ta, tb;
        for(ta=headA, tb=headB; ta != null && tb != null;,;
        for(pa=headA; ta!=null;,;
        for(pb=headB; tb!=null;,;
        for(; pa!=pb;,;
        return pa;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.