leetcode刷题36

今天刷的题是LeetCode第206题

class Solution {
    public ListNode reverseList(ListNode head) {
        return this.recursion(head,null);
    }
    public ListNode recursion(ListNode head,ListNode pre){
        if (head==null){
            return pre;
        }
        ListNode node=head.next;
        head.next=pre;
        return this.recursion(node,head);
    }
}

 

posted @ 2019-09-28 12:12  刘云生  阅读(80)  评论(0编辑  收藏  举报