当前位置:网站首页>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;
// }
// }边栏推荐
- Unity 贝塞尔曲线的创建
- 如何判断静态代码质量分析工具的性能?这五大因素必须考虑
- List conversion problem
- Mock service Moco series (II) - JSON format, file file, header, cookie, solving Chinese garbled code
- The new version of 3dcat v2.1.3 has been released. You can't miss these three function updates!
- "Jargon" | what kind of experience is it to efficiently deliver games with Devops?
- MySQL page lock
- Ch582 ble 5.0 uses Le coded broadcast and connection
- What are the advantages of real-time cloud rendering
- MySQL optimistic lock
猜你喜欢

网易严选库存中心设计实践

Keil5 “Loading PDSC Debug Description Failed for STMicroelectronics STM32Hxxxxxxx”解决办法
![Why is the index in [mysql] database implemented by b+ tree? Is hash table / red black tree /b tree feasible?](/img/1f/a2d50ec6bc97d52c1e7566a42e564b.png)
Why is the index in [mysql] database implemented by b+ tree? Is hash table / red black tree /b tree feasible?

Sorting also needs to know the information and linked list

排序还需要了解的信息以及链表

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

Drawing PDF tables (I) drawing excel table styles in PDF and downloading them through iText (supporting Chinese fonts)

Kendryte K210 在freertos上的lcd屏幕的使用

SQL那些事

Use of LCD screen of kendryte k210 on FreeRTOS
随机推荐
Unity 贝塞尔曲线的创建
Tme2022 campus recruitment background development / operation development / business operation and maintenance / application development written examination (I) a little self analysis of programming q
Redis source code and design analysis -- 18. Analysis of redis network connection Library
SLA 、SLO & SLI
STM8S003F3 内部flash调试
Connect to MySQL using sqldeveloper
MATLAB中join函数使用
文件基础知识
Redis source code and design analysis -- 17. Redis event processing
Mock service Moco series (III) - redirection, regular expression, delay, template, event, sub module design
srec_cat 常用参数的使用
Which real-time gold trading platform is reliable and safe?
Drawing PDF form (II) drawing excel form style in PDF through iText, setting Chinese font, watermark, logo, header and page number
Oracle导入出错:IMP-00038: 无法转换为环境字符集句柄
Mysql database common commands
C LINQ de Duplication & de duplication sum
imx6 RTL8189FTV移植
"Deprecated gradle features were used in this build, making it incompatible with gradle 6.0" problem solving
Landmark buildings around the world
越来越成熟的Rust,都应用了哪些场景呢?