/*
思路:
先将链表反转,这里有的是典型的链表反转方法
class Solution {
public:
vector<int> printListFromTailToHead(ListNode* head) {
vector<int> res;
ListNode* cur = head;
ListNode* pre = cur;
if(head==NULL)
return res;
while(head->next!=NULL){
cur = head->next;
head->next = cur->next;
cur->next = pre;
pre = cur;
}
while(cur){
res.push_back(cur->val);
cur = cur->next;
}
return res;
}
};
再一次将链表元素添加到数组中
*/