Recursive Solution : in-case any one needed


#1
ListNode* reverse(ListNode* curr, ListNode* prev) {
    if(!curr->next) {
        curr->next = prev;
        return curr;
    }
    ListNode* next = curr->next;
    curr->next = prev;
    return reverse(next, curr);
}
ListNode* Solution::reverseList(ListNode* A) {
    if(!A)return NULL;
    return reverse(A, NULL);
}