19 lines
389 B
C++
19 lines
389 B
C++
#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
|