Open harrytothemoon opened 3 years ago
var swapPairs = function(head) {
if (head === null) return null
if (head !== null && head.next === null) return head
let n = head.next
head.next = swapPairs(head.next.next)
n.next = head
return n
};
雖然寫過,但自己從頭寫還是想不太出來QQ