old_contents: class Solution:
      # @param a ListNode
      # @return a ListNode
      def swapPairs(self, head):
          if head == None or head.next == None:
              return head
          dummy = ListNode(0); dummy.next = head
          p = dummy
          while p.next and p.next.next:
              tmp = p.next.next
              p.next.next = tmp.next
              tmp.next = p.next
              p.next = tmp
              p = p.next.next
          return dummy.next
  
new_contents: #@author: cchen
  
  class Solution:
      # @param a ListNode
      # @return a ListNode
      def swapPairs(self, head):
          if head == None or head.next == None:
              return head
          dummy = ListNode(0); dummy.next = head
          p = dummy
          while p.next and p.next.next:
              tmp = p.next.next
              p.next.next = tmp.next
              tmp.next = p.next
              p.next = tmp
              p = p.next.next
          return dummy.next
  
subject: Update SwapPairNodes_001.py