当前位置:网站首页>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;
}
}
边栏推荐
- Testing of web interface elements
- Interface test: what are the components of the URL in fiddler
- Isam2 operation process
- 【Postman】Monitors 监测API可定时周期运行
- Summary of anomaly detection methods
- [C language] qsort function
- JWT-JSON WEB TOKEN
- F - true liars (category and search set +dp)
- Seven imperceptible truths in software testing
- LeetCode 731. 我的日程安排表 II
猜你喜欢

LeetCode 739. 每日温度
![[eolink] PC client installation](/img/91/8b3c4264e544b14f926e91edddf18d.png)
[eolink] PC client installation

On weak network test of special test

Understanding of processes and threads

(中)苹果有开源,但又怎样呢?

F - True Liars (种类并查集+DP)

selenium源码通读·9 |DesiredCapabilities类分析

Database - current read and snapshot read

Overview of three core areas of Mathematics: algebra

【Postman】Monitors 监测API可定时周期运行
随机推荐
Testing of web interface elements
Simulation volume leetcode [general] 1062 Longest repeating substring
RestTemplate、Feign实现Token传递
Database isolation level
Buuctf-[[gwctf 2019] I have a database (xiaoyute detailed explanation)
Seven imperceptible truths in software testing
Customize the gateway filter factory on the specified route
Simulation volume leetcode [general] 1109 Flight reservation statistics
[postman] the monitors monitoring API can run periodically
leaflet 地图
Redis 核心技术与实战之 基本架构:一个键值数据库包含什么?
浅谈专项测试之弱网络测试
2022 software testing workflow to know
【Postman】动态变量(也称Mock函数)
MFC关于长字符串unsigned char与CString转换及显示问题
技术分享 | 常见接口协议解析
数学三大核心领域概述:代数
Cannot create PoolableConnectionFactory (Could not create connection to database server. 错误
模拟卷Leetcode【普通】1296. 划分数组为连续数字的集合
F - True Liars (种类并查集+DP)