当前位置:网站首页>NC78 反转链表
NC78 反转链表
2022-07-25 18:13:00 【syc596】
NC78 反转链表
JZ24 反转链表
//11
//迭代
import java.util.*;
public class Solution {
public ListNode ReverseList(ListNode head) {
if(head==null||head.next==null){
return head;
}
ListNode prev=null;
ListNode cur=head;
while(cur!=null){
ListNode next=cur.next;
cur.next=prev;
prev=cur;
cur=next;
}
return prev;
}
}
// //递归
// import java.util.*;
// public class Solution {
// public ListNode ReverseList(ListNode head) {
// //递归结束条件
// if(head==null||head.next==null){
// return head;
// }
// ListNode vhead=ReverseList(head.next);
// //逆转本级节点
// head.next.next=head;
// //尾节点置空
// head.next=null;
// return vhead;
// }
// }边栏推荐
- 推荐一个沁恒的蓝牙的参考博客
- Talking about Devops monitoring, how does the team choose monitoring tools?
- 专访即构科技李凯:音视频的有趣、行业前沿一直吸引着我
- 实时云渲染有哪些优势
- 更新|3DCAT实时云渲染 v2.1.2版本全新发布
- Oracle导入出错:IMP-00038: 无法转换为环境字符集句柄
- How to judge the performance of static code quality analysis tools? These five factors must be considered
- 结合GHS MULTI使用瑞萨E1仿真器实现对瑞萨RH850单片机的仿真调试
- C语言 cJSON库的使用
- Problems faced by cloud XR and main application scenarios of cloud XR
猜你喜欢

Talking about Devops monitoring, how does the team choose monitoring tools?

Number two 2010 real test site

What is the relationship between cloud fluidization and cloud desktop

Could not stop Cortex-M device! please check the JTAG cable的解决办法

关于云XR介绍,以及5G时代云化XR的发展机遇

Auditing相关注解

泛域名配置方法

如何选择数字孪生可视化平台

Connect to MySQL using sqldeveloper

What scenarios have rust, which is becoming more and more mature, applied?
随机推荐
推荐一个沁恒的蓝牙的参考博客
List conversion problem
为什么数字化未来取决于3D实时渲染
NPDP多少分通过?如何高分通过?
Drawing PDF tables (I) drawing excel table styles in PDF and downloading them through iText (supporting Chinese fonts)
STM32F105RBT6 内部flash调试
结合GHS MULTI使用瑞萨E1仿真器实现对瑞萨RH850单片机的仿真调试
Cloud VR: the next step of virtual reality specialization
CH582 BLE 5.0 使用 LE Coded 广播和连接
Recommend a qinheng Bluetooth reference blog
MySQL数据库常用命令
Bl602 development environment setup
Which real-time gold trading platform is reliable and safe?
使用sqldeveloper连接mysql
The new version of 3dcat v2.1.3 has been released. You can't miss these three function updates!
MySQL optimistic lock
Polynomial addition
Stm8s003f3 internal flash debugging
Unittest framework application
ORB_ Slam3 recurrence - Part I