题目描述
输入一个链表,反转链表后,输出新链表的表头。class Solution: # 返回ListNode def ReverseList(self, pHead): # write code here nextNode=None p=pHead while pHead is not None: pHead=pHead.next p.next=nextNode nextNode=p p=pHead return nextNode
2024-02-24 12:29:52
class Solution: # 返回ListNode def ReverseList(self, pHead): # write code here nextNode=None p=pHead while pHead is not None: pHead=pHead.next p.next=nextNode nextNode=p p=pHead return nextNode
下一篇:18 删除链表的节点/重复节点