LeetCode 206 反转链表学习笔记

这篇是我刷 206. Reverse Linked List · 反转链表 时整理的笔记。代码只有几行,但很容易背下来却说不清每行在干嘛。所以这次用动画一行一行看。 These are my notes on 206. Reverse Linked List. The code is only a few lines, but it is easy to memorize it without being able to say what each line does. So this time I step through it line by line with an animation. 一句话总结本质: 循环里 4 行代码,只有 curr.next = prev 这一行改箭头。另外 3 行都只是在挪「标签」(变量 prev / curr / nxt 指向谁)。 The one-sentence version: ...

4 min · 768 words · Jiaju