urlname
type
Post
password
SyncToConfluence
category
Leetcode
date
Feb 27, 2023 20:42
slug
832598347308
icon
Button
catalog
summary
tags
Algorithm
链表
递归
cover
Status
BusyTime
Status 1
status
Published
题目链接
关键词
{% label 递归 green %}、{% label 链表 blue %}
解析
- 解法一:把每个节点都保存起来,然后反向链接
- 解法二:两个指针,一个先走一步,然后每次都把走得快的指针的next指向走的慢的,然后更新两个指针,一直循环到链表尾部,用迭代实现
- 解法三:跟两个指针的迭代解法思路一致,只是方法不一样,用递归实现
代码
- 解法一:
- 解法二:
- 解法三:
- Author:CoderWdd
- URL:https://www.wuinsights.top//article/832598347308
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts