C语言 | Leetcode C语言题解之第206题反转链表
题目:
题解:
struct ListNode* reverseList(struct ListNode* head) {if (head == NULL || head->next == NULL) {return head;}struct ListNode* newHead = reverseList(head->next);head->next->next = head;head->next = NULL;return newHead;
}