当前位置:网站首页>《剑指Offer》 链表反转
《剑指Offer》 链表反转
2022-07-27 14:15:00 【傻子是小傲娇】
题目描述
输入一个链表,反转链表后,输出新链表的表头。
头插法:
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public: ListNode* ReverseList(ListNode* pHead) { ListNode *new_next = NULL; ListNode *now; while (pHead != NULL){ now = pHead; pHead = pHead->next; now->next = new_next; new_next = now; } return new_next; } };
边栏推荐
- How to help enterprises optimize office management
- Notice of Nanshan District Civil Affairs Bureau on carrying out the grade evaluation of social organizations in Nanshan District in 2022
- 移动端使用vantUI的list组件,多个tab项来回切换时,列表加载多次导致数据无法正常展示
- 如何做好企业系统漏洞评估
- The database uses PSQL and JDBC to connect remotely and disconnect automatically from time to time
- 网络设备硬核技术内幕 路由器篇 15 从鹿由器到路由器 (下)
- internship:其他配置类的编写
- 一些二进制位操作
- [work] about technical architecture
- Txt replace line breaks with spaces or cancel line breaks
猜你喜欢

Graphical SQL is too vivid

4种单片机驱动继电器方案

Introduction of the connecting circuit between ad7606 and stm32
![[ManageEngine] what is Siem](/img/a6/0fbe60df6bef337a91a10fe046aa8a.jpg)
[ManageEngine] what is Siem

代码覆盖率统计神器-jacoco工具实战

Automatically configure SSH password free login and cancel SSH password free configuration script

What is the breakthrough point of digital transformation in the electronic manufacturing industry? Lean manufacturing is the key

LeetCode 781. 森林中的兔子 哈希表/数学问题 medium

【ManageEngine】什么是SIEM

What is tor? What is the use of tor browser update?
随机推荐
USB接口电磁兼容(EMC)解决方案
TL431-2.5v基准电压芯片几种基本用法
NEFU119 组合素数【算术基本定理】
仅做两项修改,苹果就让StyleGANv2获得了3D生成能力
What is the breakthrough point of digital transformation in the electronic manufacturing industry? Lean manufacturing is the key
网络设备硬核技术内幕 路由器篇 9 CISCO ASR9900拆解 (二)
LeetCode 1143. 最长公共子序列 动态规划/medium
Passive income: return to the original and safe two ways to earn
JUC(JMM、Volatile)
关于印发《深圳市工业和信息化局绿色制造试点示范管理暂行办法》的通知
[work] about technical architecture
网络设备硬核技术内幕 路由器篇 10 CISCO ASR9900拆解 (三)
谷歌团队推出新Transformer,优化全景分割方案|CVPR 2022
Visual system design example (Halcon WinForm) -9. text display
Data warehouse project is never a technical project
如何帮助企业优化Office管理
网络设备硬核技术内幕 路由器篇 14 从鹿由器到路由器 (中)
JMeter recording interface automation
反射
Design scheme of digital oscilloscope based on stm32