Python Solution


  • 2
    H
    class Solution(object):
    def oddEvenList(self, head):
        odd, p= head, head and head.next 
        while p and p.next:
            odd.next, p.next.next, p.next = p.next, odd.next, p.next.next #insert 
            odd, p = odd.next, p.next 
        return head

Log in to reply
 

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