# Easy-题目38：160. Intersection of Two Linked Lists

Write a program to find the node at which the intersection of two singly linked lists begins.

For example, the following two linked lists:

A:          a1 → a2
↘
c1 → c2 → c3
↗
B:     b1 → b2 → b3

begin to intersect at node c1.

/**
* struct ListNode {
*     int val;
*     struct ListNode *next;
* };
*/
return NULL;
struct ListNode *p;
int lengtha,lengthb;

if(lengtha>lengthb) {
for(int i=0;i<lengtha-lengthb;i++)
}
else if (lengthb>lengtha) {
for(int i=0;i<lengthb-lengtha;i++)
}
}
}

32ms，beats 18.75%，众数32ms,78.91%
cmershen的碎碎念：

#### leetcode 160: Intersection of Two Linked Lists

2014-12-30 03:17:29

#### 【LeetCode-面试算法经典-Java实现】【160-Intersection of Two Linked Lists（单链表的交集）】

2015-08-22 06:45:36

#### [leetcode]Intersection of Two Linked Lists　——　熟悉python

2014-12-11 11:41:03

#### 160. Intersection of Two Linked Lists（python）

2016-09-18 21:38:02

#### LeetCode 160 — Intersection of Two Linked Lists（C++ Python）

2014-12-02 20:59:16

#### 【LeetCode】Intersection of Two Linked Lists

2014-11-27 21:55:23

#### LeetCode 160 ：Intersection of Two Linked Lists

2015-05-14 22:06:04

#### leetcode - 160. Intersection of Two Linked Lists【2个链表 + 长度对齐 + 栈】

2017-08-08 21:28:25

2015-09-14 10:16:22

#### 【leetcode 两个链表的交集点】Intersection of Two Linked Lists

2014-11-28 00:15:09