方法一:
三指针
class Solution {//顺序public ListNode reverseList(ListNode head) {if (head == null || head.next == null) {return head;}ListNode pre = null, now = head, next = null;while (now != null) {next = now.next;now.next = pre;pre = now;now = next;}return pre;}}
方法二:
递归
