题目描述:
解法:
class Solution {
public:
vector<int> reversePrint(ListNode* head) {
int len = 0;
ListNode * temp = head;
while(temp!=NULL){
len++;
temp = temp->next;
}
vector<int> vec(len);
int i = len-1;
while(head){
vec[i] = head->val;
head = head->next;
i--;
}
return vec;
}
};