Skip to content

Commit 6ab3d10

Browse files
Create problem 8.py
1 parent 5f87603 commit 6ab3d10

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

linked_lists/python/problem 8.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution(object):
2+
def reverseList(self, head):
3+
prev = None
4+
curr = head
5+
6+
while curr:
7+
next = curr.next
8+
curr.next = prev
9+
prev = curr
10+
curr = next
11+
12+
return prev
13+

0 commit comments

Comments
 (0)