leetcode-206 反轉鏈表(ReverseLinkedList)-java

題目:反轉鏈表 反轉一個單鏈表。 進階: 鏈表可以迭代或遞歸地反轉。你能否兩個都實現一遍? public ListNode reverseList(ListNode head) { if (head == null || head.next == null) return head; ListNode p = null; ListNode q = null;
相關文章
相關標籤/搜索