剑指-Offer(七)

Yiran at 
反转链表 链接到标题 class ListNode(object): def __init__(self, x): self.val = x self.next = None def reverse_list(list_head): if not list_head or not list_head.next: return list_head reverse_node = None node_pre = None node = list_head while node: node_next = node.next if node_next == None: reverse_node = no……