标签:linked for link nod 一个 das span ret 用户
头依次拔下来,按顺序插进另一个链表:
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def reverseList(self, head: ListNode) -> ListNode: new_head=None while head: tmp=head.next head.next=new_head new_head=head head=tmp return new_head
标签:linked for link nod 一个 das span ret 用户
原文地址:https://www.cnblogs.com/taoyuxin/p/11734802.html