#include
#include
#include
using namespace std;
struct ListNode {
int val;
struct ListNode* next;
ListNode(int x) :
val(x), next(NULL) {
}
};
class Solution {
public:
vector printListFromTailToHead(ListNode* head) {
vectorArrayList;
stackarr;
ListNode* p = head;
while §
{
arr.push(p->val);
p = p->next;
}
int len = arr.size();
for (int i = 0;i < len;i++)
{
ArrayList.push_back(arr.top());
arr.pop();
}
return ArrayList;
}
};