题目:
题解:
func swapPairs(head *ListNode) *ListNode {dummyHead := &ListNode{0, head}temp := dummyHeadfor temp.Next != nil && temp.Next.Next != nil {node1 := temp.Nextnode2 := temp.Next.Nexttemp.Next = node2node1.Next = node2.Nextnode2.Next = node1temp = node1}return dummyHead.Next
}