leetcode -- Remove Nth Node From End of List -- 简单重点
来源:互联网 发布:淘宝自助装机 编辑:程序博客网 时间:2024/06/04 17:48
https://leetcode.com/problems/remove-nth-node-from-end-of-list/
two pointers to find the Nth Node from the end
class Solution(object): def removeNthFromEnd(self, head, n): """ :type head: ListNode :type n: int :rtype: ListNode """ i = head j = head for k in xrange(n - 1): i = i.next dummy_node = ListNode(0) dummy_node.next = head pre_j = dummy_node while i.next: pre_j = j i,j = i.next, j.next pre_j.next = j.next return dummy_node.next
0 0
- leetcode -- Remove Nth Node From End of List -- 简单重点
- LeetCode[Linked List]: Remove Nth Node From End of List
- 19. Remove Nth Node From End of List leetcode list
- [Leetcode]LeetCode 19:Remove Nth Node From End of 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: Remove Nth Node From End of List
- leetcode 40: Remove Nth Node From End of List
- [LeetCode] Remove Nth Node From End of List
- Leetcode 19 Remove Nth Node From End of 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] Remove Nth Node From End of List
- LeetCode 19: Remove Nth Node From End of List
- LeetCode - Remove Nth Node From End of List
- LeetCode | Remove Nth Node From End of List
- [tips]筛选特定区间内素数个数
- Search in Rotated Sorted Array
- 值得推荐的C/C++框架和库 (真的很强大)
- Android自定义View--图案解锁控件PatternLockView
- WebKit之分析Binding的案例(TestObject.idl)
- leetcode -- Remove Nth Node From End of List -- 简单重点
- JEECG 3.6 自定义表单版本发布,智能快速开发平台
- (温故而知新)之Struts2(类型转化)
- XMPP登陆demo Xcode7环境
- 黑马程序员__Java集合Collection接口
- 揭开Java IO流中的flush()的神秘面纱
- WebKit之Binding案例(testCallback.idl)
- 带有ListView的界面无法通过手势左右滑动切换界面问题解决办法
- Arduino 平台与C语言程序设计-week1-Arduino Environment-Lesson1