We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68cf22a commit 83878d0Copy full SHA for 83878d0
Algorithms/Easy/206_ReverseLinkedList/Solutions.py
@@ -0,0 +1,11 @@
1
+class Solution:
2
+ def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
3
+ prev = None
4
+
5
+ while head != None:
6
+ next = head.next
7
+ head.next = prev
8
+ prev = head
9
+ head = next
10
11
+ return prev
0 commit comments