增加淘宝群内容,修改部分文件组织

This commit is contained in:
2021-10-13 17:26:45 +08:00
parent 142168ae8e
commit 4152e12576
646 changed files with 62259 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
package 链表;
public class _206_反转链表 {
public ListNode reverseList(ListNode head) {
if (head == null || head.next == null) return head;
ListNode newHead = reverseList(head.next);
head.next.next = head;
head.next = null;
return newHead;
}
public ListNode reverseList2(ListNode head) {
if (head == null || head.next == null) return head;
ListNode newHead = null;
while (head != null) {
ListNode tmp = head.next;
head.next = newHead;
newHead = head;
head = tmp;
}
return newHead;
}
}