欢迎24级新生

2253. LeetCode Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself may be changed.

输入

Input:1->2->3->4

输出

Output:2->1->4->3.

提示

两两相邻的元素,翻转链表

登录以提交代码。
单点时限 1 秒
内存限制 128 MB
提交 0
通过 0