题目:

题解:
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
if (headA == nullptr || headB == nullptr) {
return nullptr;
}
ListNode *pA = headA, *pB = headB;
while (pA != pB) {
pA = pA == nullptr ? headB : pA->next;
pB = pB == nullptr ? headA : pB->next;
}
return pA;
}
};







![[个人感悟] 缓存应该考察哪些问题?](https://img-blog.csdnimg.cn/direct/f1162f4eb8eb47949eba19471a765f73.png#pic_center)











