leetcode-206 反转链表(ReverseLinkedList)-java

题目:反转链表 反转一个单链表。 进阶: 链表可以迭代或递归地反转。你能否两个都实现一遍? public ListNode reverseList(ListNode head) { if (head == null || head.next == null) return head; ListNode p = null; ListNode q = null;
相关文章
相关标签/搜索