I couldn't think of any simpler solution than this:


I didn’t try to look at the editorial solution beforehand. Neither do I think I could come up with this intuitively. But here’s my recursive approach which in my opinion simplest to understand:

ListNode *revList(ListNode *prev, ListNode *curr){
    ListNode *nextNode;
        return revList(curr, nextNode);
    return prev;

ListNode* Solution::reverseList(ListNode* A) {
    if(A==NULL || A->next==NULL) return A;
    return revList(NULL, A);

Let me know if you have trouble understanding this.