class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* nextNode = NULL;
ListNode* oldNode = head;
ListNode* newNode = NULL;
while (oldNode != NULL)
{
nextNode = oldNode->next;
oldNode->next = newNode;
newNode = oldNode;
oldNode = nextNode;
}
return newNode;
}
};