【劍指offer】面試題06:從尾到頭打印鏈表

06.從尾到頭打印鏈表 輸入一個鏈表的頭節點,從尾到頭反過來返回每一個節點的值(用數組返回)。web 輸入:head = [1,3,2] 輸出:[2,3,1] 遍歷而後反轉 class Solution { public: vector<int> reversePrint(ListNode* head) { vector<int> res; while(he
相關文章
相關標籤/搜索