第一种是leetcode上的真的链表反转:
A->B->C->D
ListNode *p = head, *q, *tmp = NULL; while(p){ q = p; p = p->next; q->next = tmp; tmp = q; } return tmp;分为三步骤
2023-10-09 15:43:58
第一种是leetcode上的真的链表反转:
A->B->C->D
ListNode *p = head, *q, *tmp = NULL; while(p){ q = p; p = p->next; q->next = tmp; tmp = q; } return tmp;分为三步骤