题目描述:
Reverse a singly linked list.
Hint:
A linked list can be reversed either iteratively or recursively. Could you implement both?
题目大意:
单链表逆置
提示:
用递归和迭代方式分别实现。
解题思路:
链表基本操作,递归方式参考:https://leetcode.com/discuss/34474/in-place-iterative-and-recursive-java-solution
Python代码:
迭代版本:
# Definition for singly-linked list ...