leetcode 206 反轉鏈表的三種解法

方法一:遞歸法python #遞歸法 class Solution: def reverseList(self, head: ListNode) -> ListNode: if head==None or head.next==None: return head #反轉後的末尾 也就是第一個 cur=self.reve
相關文章
相關標籤/搜索