rewrite leetcode swap nodes in pairs