In case anyone need the solution


#1

ListNode Solution::reverseList(ListNode A) {**

ListNode* p;
ListNode* q;
ListNode* r;

p = q = NULL;
r = A;

if( r == NULL )
    return NULL;

while( r != NULL ){
    
    q = r;
    r = r->next;
    q->next = p;
    p = q;
}

return p;

}