利用python赋值的特性
反转链表
http://www.nowcoder.com/questionTerminal/75e878df47f24fdc9dc3e400ec6058ca
时间复杂度O(n)
class Solution:
# 返回ListNode
def ReverseList(self, pHead):
# write code here
if not pHead:
return None
root = None
while pHead:
pHead.next,root,pHead = root,pHead,pHead.next
return root
