目录

链表模版

目录

反转链表

1
2
3
4
5
6
7
8
def reverse(head):
	tail = head
	while tail and tail.next:
		tmp = tail.next
		tail.next = tmp.next
		tmp.next = head
		head = tmp
	return head