struct ListNode* swapPairs(struct ListNode* head) {
if (head == NULL || head->next == NULL) {
return head;
}
struct ListNode* newHead = head->next;
head->next = swapPairs(newHead->next);
newHead->next = head;
return newHead;
}
leetcode【 24 两两交换链表中的节点】
猜你喜欢
转载自blog.csdn.net/qq_45657288/article/details/109063078
今日推荐
周排行