当前位置:网站首页>Sword finger offer 22 The penultimate node in the linked list
Sword finger offer 22 The penultimate node in the linked list
2022-07-18 13:18:00 【The harder you work, the luckier you are】
Put each node in the dictionary
The first 1 node n1,dic[1]=n1
The first 2 node n2,dic[2]=n2
...
The first n node nn,dic[n]=nn.
Then the penultimate k Nodes , That is, counting from the beginning n-k+1 Nodes
class Solution:
def getKthFromEnd(self, head, k):
i=0
dic={}
while head:
i+=1
dic[i]=head
head=head.next
return dic[i-k+1]
边栏推荐
猜你喜欢
随机推荐
【编程强训4】计算糖果+进制转换
[programming training 5] continuous maximum sum + statistical palindrome
金仓数据库 KingbaseES SQL 语言参考手册 (3.1.2. 域类型)
【HBZ分享】UDP协议讲解
[golang | GRC] GRC server streaming service end stream practice
东方甄选爆火背后的流量密码
金仓数据库 KingbaseES SQL 语言参考手册 (3.1.1.10. 文本搜索类型、3.1.1.11. UUID类型)
es查询案例
【剑指 Offer】从尾到头打印链表(栈思想)+ 数组中重复的数字(哈希映射)
金仓数据库 KingbaseES SQL 语言参考手册 (3.1.1.6. 布尔类型、3.1.1.7. 位串类型)
洛谷_P3383 【模板】线性筛素数_欧氏筛筛素数
剑指 Offer 63. 股票的最大利润
HMS Core图形图像技术展现最新功能和应用场景,加速构建数智生活
【机器学习】决策树 – Decision Tree
03_案例搭建【RestTemplate 调用微服务】
论文阅读:U-Net: Convolutional Networks for Biomedical Image Segmentation
什么是ECS框架?讲解 + 实战带你入门ECS框架
STL小知识点
Hcip dynamic routing experiment (RIP)
SSH local port forwarding
https://leetcode.cn/problems/lian-biao-zhong-dao-shu-di-kge-jie-dian-lcof/







![[golang | GRC] GRC server streaming service end stream practice](/img/c6/b7a81894be1bb60d19311abfc07800.png)