Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Week_01/id_19/24.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

class Solution:
def swapPairs(self, head):
dummy = pre = ListNode(0)
pre.next = head
while pre.next and pre.next.next:
a = pre.next
b = a.next
pre.next, a.next, b.next = b, b.next, a
pre = a
return dummy.next