class Solution {
public:
/**
* @param head: The first node of linked list.
* @return: The new head of reversed linked list.
*/
ListNode *reverse(ListNode *head) {
ListNode *first=NULL;
while(head!=NULL)
{
ListNode *first1;
first1=head->next;
head->next=first;
first=head;
head=first1;
}
return first;
// write your code here
}
};
水.