class Solution: # 返回从尾部到头部的列表值序列,例如[1,2,3] def printListFromTailToHead(self, listNode): # write code here res=[] while not listNode==None: res.append(listNode.val) listNode=listNode.next return res[::-1]
class Solution: # 返回从尾部到头部的列表值序列,例如[1,2,3] def printListFromTailToHead(self, listNode): # write code here res=[] while not listNode==None: res.append(listNode.val) listNode=listNode.next return res[::-1]
转载于:https://www.cnblogs.com/zhaiyansheng/p/10411214.html