当前位置:网站首页>leetcode 24. Exchange the nodes in the linked list in pairs
leetcode 24. Exchange the nodes in the linked list in pairs
2022-07-06 06:18:00 【henujolly】
class Solution {
public ListNode swapPairs(ListNode head) {
ListNode dummyHead = new ListNode();
dummyHead.next = head;
ListNode temp = dummyHead;
while (temp.next != null && temp.next.next != null) {
ListNode node1 = temp.next;
ListNode node2 = temp.next.next;
temp.next = node2;
node1.next = node2.next;
node2.next = node1;
temp = node1;
}
return dummyHead.next;
}
}
边栏推荐
- G - Supermarket
- Still worrying about how to write web automation test cases? Senior test engineers teach you selenium test case writing hand in hand
- Simulation volume leetcode [general] 1109 Flight reservation statistics
- 联合索引的左匹配原则
- 2022 software testing workflow to know
- 测试周期被压缩?教你9个方法去应对
- 职场进阶指南:大厂人必看书籍推荐
- 曼哈顿距离与曼哈顿矩形-打印回字型矩阵
- Database - current read and snapshot read
- Buuctf-[bjdctf2020]zjctf, but so (xiaoyute detailed explanation)
猜你喜欢

On weak network test of special test
![Buuctf-[bjdctf2020]zjctf, but so (xiaoyute detailed explanation)](/img/c9/56fba6054c91f090de31463a8b4705.jpg)
Buuctf-[bjdctf2020]zjctf, but so (xiaoyute detailed explanation)
![[postman] collections - run the imported data file of the configuration](/img/85/7ac9976fb09c465c88f376b2446517.png)
[postman] collections - run the imported data file of the configuration

数学三大核心领域概述:代数

10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
![[C language] string left rotation](/img/5f/66bcc8f992108bf3b7e455709d3174.png)
[C language] string left rotation

二维码的前世今生 与 六大测试点梳理

LeetCode 732. 我的日程安排表 III

[no app push general test plan
![[ram IP] introduction and experiment of ram IP core](/img/34/1c988456e32a8e9840d1d073caefbf.jpg)
[ram IP] introduction and experiment of ram IP core
随机推荐
模拟卷Leetcode【普通】1091. 二进制矩阵中的最短路径
Linux regularly backs up MySQL database
Simulation volume leetcode [general] 1109 Flight reservation statistics
LeetCode 732. 我的日程安排表 III
JDBC Requset 对应内容及功能介绍
Construction and integration of Zipkin and sleuth for call chain monitoring
黑猫带你学UFS协议第18篇:UFS如何配置逻辑单元(LU Management)
Cannot create PoolableConnectionFactory (Could not create connection to database server. 错误
Database - current read and snapshot read
PAT(乙级)2022年夏季考试
Buuctf-[gxyctf2019] no dolls (xiaoyute detailed explanation)
Buuctf-[[gwctf 2019] I have a database (xiaoyute detailed explanation)
IP day 16 VLAN MPLS configuration
通过修改style设置打印页样式
Simulation volume leetcode [general] 1143 Longest common subsequence
调用链监控Zipkin、sleuth搭建与整合
还在为如何编写Web自动化测试用例而烦恼嘛?资深测试工程师手把手教你Selenium 测试用例编写
對數據安全的思考(轉載)
D - How Many Answers Are Wrong
Idea new UI usage