# Intersection of Two Linked Lists

/**
* public class ListNode {
*     int val;
*     ListNode next;
*     ListNode(int x) {
*         val = x;
*         next = null;
*     }
* }
*/
public class Solution {
return null;
}
int len1 = 1, len2 = 1;
while (cur1.next != null) {
cur1 = cur1.next;
len1++;
}
while (cur2.next != null) {
cur2 = cur2.next;
len2++;
}
if (len1 > len2) {
for (int i = 0; i < len1 - len2; i++) {
cur1 = cur1.next;
}
} else {
for (int i = 0; i < len2 - len1; i++) {
cur2 = cur2.next;
}
}
while (cur1 != null && cur2 != null) {
if (cur1 == cur2) {
return cur1;
}
cur1 = cur1.next;
cur2 = cur2.next;
}
return null;
}
}

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

2014-12-30 03:17:29

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

2014-11-27 21:55:23

#### [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 160 ：Intersection of Two Linked Lists

2015-05-14 22:06:04

#### [LeetCode][160][Intersection of Two Linked Lists ]

2015-04-11 18:56:52

2015-09-14 10:16:22

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

2014-11-28 00:15:09

#### Leetcode_160_Intersection of Two Linked Lists

2014-11-29 10:37:20