problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
acwing::acwing35::Solution类 参考

#include <acwing.h>

静态 Public 成员函数

static ListNodereverseList (ListNode *head)
 

详细描述

在文件 acwing.h1601 行定义.

成员函数说明

◆ reverseList()

ListNode * acwing::acwing35::Solution::reverseList ( ListNode head)
static

在文件 acwing.cpp5025 行定义.

5025 {
5026 if(head == nullptr) {
5027 return head;
5028 }
5029 auto *prev = head;
5030 auto *current = head->next;
5031 while(current != nullptr) {
5032 auto *next = current->next;
5033 current->next = prev;
5034 prev = current;
5035 current = next;
5036 }
5037 head->next = nullptr;
5038 return prev;
5039 }

该类的文档由以下文件生成: