Leetcode 206. Reverse Linked List (python+cpp)

Leetcode 206. Reverse Linked List

  • 题目
  • 解法:recursive和iterative

题目

Leetcode 206. Reverse Linked List (python+cpp)_第1张图片

解法:recursive和iterative

python版recursive解法:

class Solution:
    def reverseList(self, head: ListNode) -> ListNode:
      

你可能感兴趣的:(Leetcode,链表,python,leetcode,c++,链表)