/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
vector<int> printListReversingly(ListNode* head) {
vector<int> v;
while(head)//把链表中的值赋给v
{
v.push_back(head->val);
head=head->next;
}
reverse(v.begin(),v.end());//将vector里的数据反转的方式
return v;
}
};