Reverse Linked List(dfs)
Reverse a singly linked list.
Example:
Follow up:
A linked list can be reversed either iteratively or recursively. Could you implement both?
recursive记得return回新头(原来尾)
iterative Null或者单个数不要倒了。记得返回的是prev
Last updated
Reverse a singly linked list.
Example:
Follow up:
A linked list can be reversed either iteratively or recursively. Could you implement both?
recursive记得return回新头(原来尾)
iterative Null或者单个数不要倒了。记得返回的是prev
Last updated