This commit is contained in:
2022-12-02 16:06:34 +08:00
parent 9d2a8bccfe
commit 7bc754ae03
2 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
#ifndef S0206_REVERSE_LINKED_LIST_HPP
#define S0206_REVERSE_LINKED_LIST_HPP
struct ListNode {
int val;
ListNode* next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode* next) : val(x), next(next) {}
};
class S0206 {
public:
ListNode* reverseList1(ListNode* head);
ListNode* reverseList2(ListNode* head);
};
#endif