Alternate recursive solution cpp


#1
ListNode* Solution::reverseList(ListNode* A) {
if(!A) return NULL;
ListNode* first = reverseList(A->next);
if(!first) return new ListNode(A->val);
ListNode* current = first;
while(current->next)
    current = current->next;
current->next = new ListNode(A->val);
return first;

}