ListNode* reverseList(ListNode* head) {
using node = ListNode;
node* prev{ nullptr };
node* next{ nullptr };
node* current{ head };
while (current != nullptr) {
next = current->next;
current->next = prev;
prev = current;
current = next;
}
return prev;
}