var swapPairs = function(head) {
let dummy=new ListNode();
dummy.next=head;
let current=dummy;
while(current.next!=null&¤t.next.next!=null){
let n1=current.next;
let n2=current.next.next;
current.next=n2;
n1.next=n2.next;
n2.next=n1;
current=n1;
}
return dummy.next;
};
24.两两交换链表中的结点
于 2022-01-18 17:44:43 首次发布