Quesstion
Reverse a singly linked list.
click to show more hints.
Hint: A linked list can be reversed either iteratively or recursively. Could you implement both?
Explanation
Iterative Solution
定义一个previous node,一个current node,倒过来。并记下之前的后面一个节点,循环。