parameters: (self, head)
return_statement: return result
docstring: :type head: Optional[ListNode]
          :rtype: int
docstring_summary: :type head: Optional[ListNode]
          :rtype: int
docstring_tokens: : type head : Optional [ ListNode ] : rtype : int
function: def pairSum(self, head):
          """
          :type head: Optional[ListNode]
          :rtype: int
          """
          def reverseList(head):
              dummy = ListNode()
              while head:
                  dummy.next, head.next, head = head, dummy.next, head.next
              return dummy.next
  
          dummy = ListNode(next=head)
          slow = fast = dummy
          while fast.next and fast.next.next:
              slow, fast = slow.next, fast.next.next
          result = 0
          head2 = reverseList(slow)
          while head:
              result = max(result, head.val+head2.val)
              head, head2 = head.next, head2.next
          return result
function_tokens: def pairSum ( self , head ) : def reverseList ( head ) : dummy = ListNode ( ) while head : dummy . next , head . next , head = head , dummy . next , head . next return dummy . next dummy = ListNode ( next = head ) slow = fast = dummy while fast . next and fast . next . next : slow , fast = slow . next , fast . next . next result = 0 head2 = reverseList ( slow ) while head : result = max ( result , head . val + head2 . val ) head , head2 = head . next , head2 . next return result