def ReverseList(pHead): # write code here # write code here if not pHead or not pHead.next: return pHead last = None while pHead: tmp = pHead.next pHead.next = last last = pHead pHead = tmp return last
def ReverseList(pHead): # write code here # write code here if not pHead or not pHead.next: return pHead last = None while pHead: tmp = pHead.next pHead.next = last last = pHead pHead = tmp return last
原文:https://www.cnblogs.com/gczr/p/8167982.html