• 【leetcode】链表相交


    struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {
        if(!headA || !headB) return NULL;
        struct ListNode *pa = headA;
        struct ListNode *pb = headB;
        while(pa != pb)
        {
            pa = (pa)? pa->next : headB;
            pb = (pb)? pb->next : headA;
        }
        return pa;
    }
  • 相关阅读:
    053-49
    053-3
    053-204
    053-491
    053-205
    053-57
    053-149
    053-47
    053-150
    回答2
  • 原文地址:https://www.cnblogs.com/ganxiang/p/13727356.html
Copyright © 2020-2023  润新知