当前位置:网站首页>#yyds dry goods inventory# Interview must brush TOP101: the last k nodes in the linked list
#yyds dry goods inventory# Interview must brush TOP101: the last k nodes in the linked list
2022-08-01 18:52:00 【51CTO】
1.简述:
输入一个长度为 n 的链表,设链表中的元素的值为 ai ,返回该链表中倒数第k个节点.
如果该链表长度小于k,请返回一个长度为 0 的链表.
数据范围:,
,
要求:空间复杂度 ,时间复杂度
进阶:空间复杂度 ,时间复杂度
例如输入{1,2,3,4,5},2时,对应的链表结构如下图所示:

其中蓝色部分为该链表的最后2个结点,所以返回倒数第2个结点(也即结点值为4的结点)即可,系统会打印后面所有的节点来比较.
输入:
返回值:
说明:
输入:
返回值:
2.代码实现:
边栏推荐
- Solve the problem that MySQL cannot insert Chinese data
- LeetCode 0152. 乘积最大子数组:dp + 原地滚动
- LeetCode 1374. Generate an odd number of each character string
- JVM运行时数据区与JMM内存模型是什么
- Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021:解读
- Leetcode75. Color Classification
- 硬件大熊原创合集(2022/07更新)
- Fuzzy query in Map pass-by-value and object pass-by-value
- Detailed explanation of DBPack SQL Tracing function and data encryption function
- Stop using MySQL online DDL
猜你喜欢
Stop using MySQL online DDL

粒子滤波 particle filter —从贝叶斯滤波到粒子滤波——Part-I(贝叶斯滤波)

XML配置

C language theory--a solid foundation for the written test and interview

Hardware Bear Original Collection (Updated 2022/07)

无需破解,官网安装Visual Studio 2013社区版

LeetCode 0152. 乘积最大子数组:dp + 原地滚动

How to build a CMDB driven by consumption scenarios?

Leetcode72. Edit Distance

483-82(23、239、450、113)
随机推荐
B001 - Intelligent ecological fish tank based on STM32
屏:全贴合工艺之GFF、OGS、Oncell、Incell
Industry Salon Phase II丨How to enable chemical companies to reduce costs and increase efficiency through supply chain digital business collaboration?
在Map传值与对象传值中模糊查询
塔防海岸线用户协议
opencv syntax Mat type summary
在全志V853开发板试编译QT测试
bat 批示处理详解-2
What is the JVM runtime data area and the JMM memory model
WinRAR | Generate multiple installers into one installer
C#/VB.NET: extracted from the PDF document all form
odoo+物联网
【无标题】setInterval和setTimeout详解
Prometheus's Recording rules practice
Keras深度学习实战——交通标志识别
el-form-item prop属性动态绑定不生效如何解决
ACID Characteristics and Implementation Methods of MySQL Relational Database Transactions
SQL function TO_DATE (1)
MySQL Lock wait timeout exceeded; try restarting transaction 锁等待
无需破解,官网安装Visual Studio 2013社区版