My Python simple Solution

  • 0
        def oddEvenList(self, head):
            if not head: return head
            dump = ListNode(0)
   = head
            # po, pe are the pointers pointing to odd and even nodes, respectively
            po, even = head,
            pe = even
            while pe and
                po =
                    pe =
           = None
   = even

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.