OFF6

 vector<int> reversePrint(ListNode* head) {
        vector<int> ans;
        if(head==NULL){
            return ans;
        }
        ListNode* cur=head;
        while(cur!=NULL){
            ans.insert(ans.begin(),cur->val);
            cur=cur->next;
        }
       return ans;

    }
posted @ 2022-10-01 18:41  lwx_R  阅读(34)  评论(0)    收藏  举报