class
Solution {
public
:
vector<
int
> printListFromTailToHead(ListNode* head) {
vector<
int
> v,v1;
while
(head!=NULL)
{
v.push_back(head->val);
head=head->next;
}
for
(
int
i=v.size()-
1
;i>=
0
;i--)
{
v1.push_back(v[i]);
}
return
v1;
}