用的递归的方法
struct Node
{
int value;
Node* next;
}
Node* SwapPairs(Node* head)
{
if(head == NULL || head->next == NULL)
return head;
Node* first = head;
Node* second = head->next;
first->next = SwapPairs(second->next);
second->next = first;
return second;
}
1606

被折叠的 条评论
为什么被折叠?



