题解 | #反转链表#
反转链表
https://www.nowcoder.com/practice/75e878df47f24fdc9dc3e400ec6058ca
class Solution:
def ReverseList(self , head: ListNode) -> ListNode:
pre = None
current = head
while current != None:
next_node = current.next
current.next = pre
pre = current
current = next_node
return pre
