Python solution


  • 0
    W

    class solution():
    def swap(self,head):
    temp = head
    nextone = head
    mid = 0
    while temp:
    nextone = temp.p
    mid = temp.v
    temp.v = nextone.v
    nextone.v = mid
    temp = temp.p.p
    return head


Log in to reply
 

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