您的位置:首页 > 其它

Leetcode-Intersection of Two Linked Lists

2015-02-24 06:31 295 查看
For example, the following two linked lists:
A:          a1 → a2
↘
c1 → c2 → c3
↗
B:     b1 → b2 → b3


begin to intersect at node c1.

想复杂了,题目默认只要找到了intersection的开始 后面一定都是intersect的。

注意java里面所有东西都是指针,声明指针就像声明变量。

就像总结里面的two pointers类型题,首先计算长度,然后通过指针将两个list对齐,然后再进行判断。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: