当前位置:网站首页>Leetcode 206.反转链表I
Leetcode 206.反转链表I
2022-07-19 16:38:00 【零子若】
本文仅为个人刷题遇到问题解析记录,题目和答案均在官网!!!
反转链表I
反转链表I:
迭代法:
Q1:反转链表的循环四语句具体作用是什么?
A1:
while(curr != nullptr)
{
ListNode* next = curr->next;//这句话是记录当前节点的下一个节点。
curr->next = prev;//当前节点反转,即下一个节点变成自己之前的节点
prev = curr;//为下一个点考虑,将当前节点记录下来,因为当前节点就是下一个节点反转后的前一个节点
curr = next;//准备进入下一轮循环,此时当前节点改变。为原来的节点的下一个节点
}
边栏推荐
- Calculate the centroid with MATLAB
- 信息学与数学、奥数的关系(2022.07.19)C
- After graduating from college in 19 years, I chose software testing after recognizing the truth of life
- CPU reads and writes to memory
- XSS (cross site scripting attack) vulnerability understanding
- Software testing and application final review
- 数据查询必备技能SQL调优:Mysql什么情况下不走索引
- Go fastdfs distributed file system construction (implementation sorting)
- kubernates-1.24.2 (最新版) + containerd + nexus 尝鲜
- Arcgis/arcpy convert floating-point grid to integer grid
猜你喜欢
背包问题
Fill polygon with MATLAB
用户名枚举漏洞怎么解决
Arcgis/arcpy convert floating-point grid to integer grid
疫情之下,软件测试的出路在哪?
Solution of webdriver click login failure
Pycharm Debug错误“Process finished with exit code -1073741819 (0xC0000005)”解决方案
Arcpy batch conversion data projection (taking Albers as an example)
Matlab填充影像中的无效值
Fix the error reported by the redis connection of the celery configuration under windows (typeerror: _initu () got an unexpected keyword argument)
随机推荐
多线程FTP项目(4)—— Mysql数据库 + FTP
Cobbler offline installation
Curd of odoo basic development (add, delete, check, change)
Docker configuration mysql, redis
ExpandableListView嵌套Gridview显示不全的问题
Database persistence +jdbc database connection
There are 13 steps to install pychart, isn't it? (super detailed tutorial)
Matlab calculates the distance between two points (longitude and latitude coordinates) (large arc method and haversine method)
Arcgis/arcpy convert floating-point grid to integer grid
Matlab cell保存为.csv格式
go语言环境搭建和样例
[software testing] what kind of resume can HR like at a glance
Chapter VIII IO
为 KubeSphere 集群启用免费的泛域名 SSL 证书并实现证书自动更新和分发
arcpy批量转换数据投影(以Albers为例)
常见浏览器兼容性问题及解决办法总结
ArcGIS导出地图后部分图例不显示
R语言“Error in nls 循环次数超过了50”解决方案
Netease game Flink SQL platform practice
ASP function split() corresponds to PHP function explode() string variable array