24 lines
496 B
C++
24 lines
496 B
C++
#ifndef S0025_REVERSE_NODES_IN_K_GROUP_HPP
|
|
#define S0025_REVERSE_NODES_IN_K_GROUP_HPP
|
|
|
|
#include <tuple>
|
|
#include <utility>
|
|
|
|
using namespace std;
|
|
|
|
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 S0025 {
|
|
public:
|
|
ListNode* reverseKGroup(ListNode* head, int k);
|
|
pair<ListNode*, ListNode*> myReverse(ListNode* head, ListNode* tail);
|
|
};
|
|
|
|
#endif
|