Skip to content

Commit 5481072

Browse files
committed
添加解法
1 parent 88fcd88 commit 5481072

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

animation-simulation/链表篇/剑指Offer52两个链表的第一个公共节点.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,14 @@ class Solution:
223223

224224
好啦,链表的题目就结束啦,希望大家能有所收获,下周就要更新新的题型啦,继续坚持,肯定会有收获的。
225225

226+
<br/>
226227

227-
228-
228+
> 贡献者[@jaredliw](https://github.com/jaredliw)注:
229+
>
230+
> 在这里带大家来看看一些其他的解题方法,虽然没有双指针有效,但还是值得一试。
231+
>
232+
> 1. 两个链表各遍历一次,找出长度。根据长度差k,让较长的那个链表先走k步。之后再两个指针一起走,由于起点一样,两个指针必将一起到达公共节点。
233+
> 2. 将其中一条链表的头和尾相连,公共节点就是环的入口,直接套用之前学过的算法就可以啦。(这解法看得我拍腿叫好)
229234

230235

231236

0 commit comments

Comments
 (0)