Lintcode166 Nth to Last Node in List solution 题解
来源:互联网 发布:尼康优化校准设置技巧 编辑:程序博客网 时间:2024/06/07 04:56
【题目描述】
Find the nth to last element of a singly linked list.
The minimum number of nodes in list is n.
找到单链表倒数第n个节点,保证链表中节点的最少数量为n。
【题目链接】
www.lintcode.com/en/problem/nth-to-last-node-in-list/
【题目解析】
这一道找倒数第n个结点的链表题,可用双指针做。
由于链表没有得到长度的值,只能通过一个一个移来进行判断
可fast先走n,然后fast和slow一起走,直到fast为null,slow的位置就是倒数第n个位置。
【参考答案】
www.jiuzhang.com/solutions/nth-to-last-node-in-list/
阅读全文
0 0
- Lintcode166 Nth to Last Node in List solution 题解
- nth-to-last-node-in-list
- Nth to Last Node in List
- [刷题]Nth to Last Node in List
- [Lintcode]Nth to Last Node in List
- #166 Nth to Last Node in List
- Nth to Last Node in List
- 快慢指针-----Nth to Last Node in List
- Lintcode174 Remove Nth Node From End of List solution 题解
- LintCode Nth to Last Node in List 链表倒数第n个节点
- LintCode | Easy | 链表倒数第n个节点 | Nth to Last Node in List
- 166.Nth to Last Node in List-链表倒数第n个节点(容易题)
- Ch2-2: return the nth to the last node data of a singly linked list
- LeetCode题解:Remove Nth Node from End of List
- leetcode 题解 || Remove Nth Node From End of List 问题
- LeetCode题解:Remove Nth Node From End of List
- Leetcode题解 19. Remove Nth Node From End of List
- 19. Remove Nth Node From End of List题解
- 主成分变换的实现
- Cpp获取Windows系统版本
- LintCode 第632题 二叉树的最大节点
- springboot入门之mybatis
- [JSOI2007]字符加密Cipher
- Lintcode166 Nth to Last Node in List solution 题解
- javascript和易语言取GetCrc32
- Android Studio, Element path must be declared for FileProvider
- 单链表逆序打印方法
- border-radius
- 一场没有硝烟的战争---端口争夺战
- 扑克牌顺子
- Python中的random模块
- Android studio 混合编程(一)