python实现链表翻转

class Solution:
    # 返回ListNode
    def ReverseList(self, pHead):
        # write code here
        c=pHead
        p=None
        while c:
            l=c.next
            c.next=p
            p=c
            c=l
        return p
        

猜你喜欢

转载自blog.csdn.net/mieleizhi0522/article/details/88950777
今日推荐