vector<int> printListFromTailToHead(ListNode* head) { vector<int> res; if(!head) return res; ListNode *p = head; while(p) { res.push_back(p->val); p = p->next; } reverse(res.begin(),res.end()); return res; }
posted on 2017-02-28 02:56 123_123 阅读(91) 评论(0) 编辑 收藏 举报