• + 0 comments

    Did it with simple vector in C++

    void reversePrint(SinglyLinkedListNode* llist) {
        vector<int> arr;
        SinglyLinkedListNode* temp = llist;
        while(temp != NULL){
            arr.push_back(temp->data);
            temp = temp->next;
        }
        for(int i = arr.size() - 1; i >= 0; i--){
            cout << arr[i] << endl;
        }
    }