This commit is contained in:
2022-11-30 18:20:36 +08:00
parent b13cfa00bb
commit 72555b19e0
132 changed files with 332 additions and 334 deletions

View File

@@ -1,7 +1,7 @@
#include "s0025_reverse_nodes_in_k-group.hpp"
// 翻转一个子链表,并且返回新的头与尾
pair<ListNode*, ListNode*> myReverse(ListNode* head, ListNode* tail) {
pair<ListNode*, ListNode*> S0025::myReverse(ListNode* head, ListNode* tail) {
ListNode* prev = tail->next;
ListNode* p = head;
while (prev != tail) {
@@ -13,7 +13,7 @@ pair<ListNode*, ListNode*> myReverse(ListNode* head, ListNode* tail) {
return {tail, head};
}
ListNode* Solution::reverseKGroup(ListNode* head, int k) {
ListNode* S0025::reverseKGroup(ListNode* head, int k) {
ListNode* hair = new ListNode(0);
hair->next = head;
ListNode* pre = hair;