图解链表反转
python实现1
python实现2
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ p=None while head: temp=head head=head.next temp.next=p p=temp return phttps://blog.csdn.net/feliciafay/article/details/6841115
