首页 > 其他分享 >lc-0921

lc-0921

时间:2022-09-21 19:57:31浏览次数:43  
标签:head null ListNode lc 0921 next curr prev

lc206 反转链表

class Solution {
    public ListNode reverseList(ListNode head) {
        ListNode prev = null;
        ListNode curr = head;
        while (curr != null) {
            ListNode next = curr.next;
            curr.next = prev;
            prev = curr; 
            curr = next;
        }
        return prev;
    }
}

标签:head,null,ListNode,lc,0921,next,curr,prev
From: https://www.cnblogs.com/beichuang/p/16716926.html

相关文章