当前位置:网站首页>力扣(LeetCode)206. 反转链表(2022.07.25)
力扣(LeetCode)206. 反转链表(2022.07.25)
2022-07-26 07:27:00 【ChaoYue_miku】
给你单链表的头节点 head ,请你反转链表,并返回反转后的链表。
示例 1:
输入:head = [1,2,3,4,5]
输出:[5,4,3,2,1]
示例 2:
输入:head = [1,2]
输出:[2,1]
示例 3:
输入:head = []
输出:[]
提示:
链表中节点的数目范围是 [0, 5000]
-5000 <= Node.val <= 5000
来源:力扣(LeetCode)
方法一:迭代
C++提交内容:
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode* prev = nullptr;
ListNode* curr = head;
while (curr) {
ListNode* next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
}
return prev;
}
};
边栏推荐
- Taishan Office Technology Lecture: how to calculate page blank (margin)
- NFT数字藏品系统开发:华为发布首款珍藏版数字藏品
- Apache dolphin scheduler 2.x nanny level source code analysis, China Mobile engineers uncover the whole process of service scheduling and start
- PostgreSQL UUID fuzzy search UUID string type conversion SQL error [42883] explicit type casts
- Differences in the use of function call pointer parameters *p, * & P
- Leetcode:1898. maximum number of removable characters [if you want to delete some IDX from a pile of things, don't use pop]
- Hcip--- MPLS detailed explanation and BGP route filtering
- Talent column | can't use Apache dolphin scheduler? The most complete introductory tutorial written by the boss in one month [3]
- NLP natural language processing - Introduction to machine learning and natural language processing (3)
- PR subtitle production
猜你喜欢

C51与MDK共存 Keil5安装教程
![PostgreSQL UUID fuzzy search UUID string type conversion SQL error [42883] explicit type casts](/img/ba/28afaead68c9ff47d15d5c5395d9ce.png)
PostgreSQL UUID fuzzy search UUID string type conversion SQL error [42883] explicit type casts

redis-migrate-tool迁移报错。

Crawler data analysis

Uncover the mystery of cloud native data management: operation level

VScode无法启动问题解决思路

7月消息,Glassnode数据显示,Deribit上ETH永续期货合约未平仓头寸刚刚达到一个月高点237,959,827美元。

China Unicom transformed the Apache dolphin scheduler resource center to realize the one-stop access of cross cluster call and data script of billing environment

The interface automation test with a monthly salary of 12k+ takes you to get started in 3 minutes

NFT数字藏品系统开发:激活数字文化遗产
随机推荐
模型剪枝三:Learning Structured Sparsity in Deep Neural Networks
NFT数字藏品开发:数字艺术藏品赋能公益平台
Apache dolphin scheduler version 3.0.0-beta-1 was released, and flinksql and Zeppelin task types were added
PXE高效批量网络装机
hot100 哈希
深度学习模型部署
DevExpress.XtraEditors.DataNavigator用法
NFT数字藏品系统开发:激活数字文化遗产
C# 使用Log4Net记录日志(基础篇)
ModuleNotFoundError: No module named ‘pip‘解决办法
NFT数字藏品开发:数字藏品助力企业发展
Simulation of transfer function step response output of botu PLC first-order lag system (SCL)
Learn browser decoding from XSS payload
Compose canvas custom circular progress bar
It's another summer of open source. 12000 project bonuses are waiting for you!
又是一年开源之夏,1.2万项目奖金等你来拿!
NLP natural language processing - Introduction to machine learning and natural language processing (3)
What is bloom filter in redis series?
Apache Dolphinscheduler3.0.0-beta-1 版本发布,新增FlinkSQL、Zeppelin任务类型
With someone else's engine, can it be imitated?