当前位置:网站首页>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;
}
};
边栏推荐
- 剑指 Offer 40. 最小的k个数
- K8s application (IV) - build a redis5 cluster (for direct external access)
- EN 45545-2:2020 T11烟毒性检测
- Installation (detailed illustration) and use of SVN
- Matlab learning 8- linear and nonlinear sharpening filtering and nonlinear smoothing filtering of image processing
- SAP abap 字段符号
- MySQL advanced features, you can read more about it and meet the interview
- EN 45545-2:2020 T11 smoke toxicity test
- Display DIN 4102-1 Class B1 fire test requirements
- Sword finger offer 62 The last remaining number in the circle
猜你喜欢

(一)aac开篇-核心组件原理之Lifecycle、LiveData、ViewModel与源码分析技巧(转载)

剑指 Offer 51. 数组中的逆序对

How to apply for BS 476-7 sample for display? Is it the same as the display

Hibernate L2 cache

leetcode - 739. 每日温度

leetcode - 460. LFU 缓存

标准化编写知识

Matlab学习7-图像处理之线性平滑滤波

Which Apple devices support this system update? See if your old apple device supports the latest system

MySQL核心点笔记
随机推荐
leetcode - 460. LFU cache
SAP abap 字段符号
Matlab learning 9- nonlinear sharpening filter for image processing
剑指 Offer 10- II. 青蛙跳台阶问题
leveldb简单使用样例
MySQL advanced features, you can read more about it and meet the interview
EN 45545-2:2020 T11烟毒性检测
c的printf相关
E. X的放大与缩小(运算符重载)
九九乘法表
补2:圆环回原点问题
(一)aac开篇-核心组件原理之Lifecycle、LiveData、ViewModel与源码分析技巧(转载)
206. 反转链表
Using docker compose to build redis5 cluster
Sword finger offer 62 The last remaining number in the circle
EN 45545-2:2020 T11 smoke toxicity test
File system check of the root filesystem failed
2095. 删除链表的中间节点
1721. 交换链表中的节点
Printf correlation of C