力扣 160 - Intersection of Two Linked Lists. (相交链表) Python双指针

力扣 160 - Intersection of Two Linked Lists. (相交链表) Python双指针

原题地址:https://leetcode.com/problems/intersection-of-two-linked-lists/

Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.

For example, the following two linked lists begin to intersect at node c1:

力扣 160 - Intersection of Two Linked Lists. (相交链表) Python双指针_第1张图片

It is guaranteed that there are no cycles anywhere in the entire linked structure.

Note that the linked lists must retain their original structure after the function returns.


例子

Example 1

你可能感兴趣的:(Leetcode,刷题)