当前位置:网站首页>Sword finger offer 06 Print linked list from end to end
Sword finger offer 06 Print linked list from end to end
2022-06-11 08:55:00 【Drag is me】
leetcode Force button to brush questions and punch in
subject : The finger of the sword Offer 06. Print linked list from end to end
describe : Enter the head node of a linked list , Return the value of each node from the end to the end ( Return with array ).
Their thinking
1、 Traversing the linked list , Store the value of each linked list node in the array , And then use reverse Function invert array ;
Source code ##
class Solution {
public:
vector<int> reversePrint(ListNode* head) {
vector<int>v;
while (head) {
v.emplace_back(head->val);
head = head->next;
}
reverse(v.begin(), v.end());
return v;
}
};
边栏推荐
- BS 7176 fire resistance test for upholstered furniture
- MySQL advanced features, you can read more about it and meet the interview
- Screening frog log file analyzer Chinese version installation tutorial
- SAP ABAP data types and data objects
- How to apply for ASTM E108 flame retardant test for photovoltaic panels?
- Codeworks round 723 (Div. 2)
- Matlab学习9-图像处理之非线性锐化滤波
- 九九乘法表
- 203. 移除链表元素
- Zipkin入门
猜你喜欢

Sword finger offer 10- ii Frog jumping on steps

leetcode - 518. 零钱兑换 II

M1 chip guide: M1, M1 pro, M1 Max and M1 ultra
![[Clickhouse column] user initialization of new library role](/img/00/a11fb1a8e38ed4e0634839160c8ead.png)
[Clickhouse column] user initialization of new library role

显示器要申请BS 476-7 怎么送样?跟显示屏一样吗

补2:圆环回原点问题

What is the process of en 1101 flammability test for curtains?

马志强:语音识别技术研究进展和应用落地分享丨RTC Dev Meetup

TextView文本大小自动适配与TextView边距的去除

端口占用问题,10000端口
随机推荐
Matlab learning 7- linear smoothing filtering of image processing
How to apply for ASTM E108 flame retardant test for photovoltaic panels?
(二)从架构设计角度分析AAC源码-我的LiveData
SAP ABAP field symbol
Usage and difference between map and set in JS
Implementation of CRF for named entity recognition
Award winning survey | how Apache pulsar lived in 2022, you the final say
C语言打印菱形
Supplement 2: circle returning to origin
SQL基本查询
Interprocess communication
2130. 链表最大孪生和
Matlab学习7-图像处理之线性平滑滤波
Sword finger offer 10- ii Frog jumping on steps
九九乘法表
19. 删除链表的倒数第 N 个结点
MATLAB R2022a 安装教程
显示屏DIN 4102-1 Class B1防火测试要求
【C语言-数据存储】数据在内存中是怎样存储的?
c的printf相关