摘要: 原题地址:http://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/题意:Given a linked list, remove thenthnode from the end of list and return its he... 阅读全文
posted @ 2014-04-30 18:42 南郭子綦 阅读(4907) 评论(0) 推荐(0)
摘要: 原题地址:http://oj.leetcode.com/problems/swap-nodes-in-pairs/题意:将链表中的节点两两交换。Given1->2->3->4, you should return the list as2->1->4->3.解题思路:这题主要涉及到链表的操作,没什么... 阅读全文
posted @ 2014-04-30 18:10 南郭子綦 阅读(3254) 评论(0) 推荐(0)
摘要: 原题地址:http://oj.leetcode.com/problems/linked-list-cycle-ii/题意:如果链表中存在环路,找到环路的起点节点。解题思路:这道题有点意思。首先使用快慢指针技巧,如果fast指针和slow指针相遇,则说明链表存在环路。具体技巧参见上一篇http://w... 阅读全文
posted @ 2014-04-30 17:46 南郭子綦 阅读(3985) 评论(0) 推荐(0)
摘要: 原题地址:http://oj.leetcode.com/problems/linked-list-cycle/题意:判断链表中是否存在环路。解题思路:快慢指针技巧,slow指针和fast指针开始同时指向头结点head,fast每次走两步,slow每次走一步。如果链表不存在环,那么fast或者fast... 阅读全文
posted @ 2014-04-30 16:33 南郭子綦 阅读(4233) 评论(0) 推荐(0)
摘要: 原题地址:http://oj.leetcode.com/problems/lru-cache/题意:设计LRU Cache参考文献:http://blog.csdn.net/hexinuaa/article/details/6630384 这篇博文总结的很到位。 https://github... 阅读全文
posted @ 2014-04-30 16:15 南郭子綦 阅读(7283) 评论(0) 推荐(0)
摘要: 原题地址:http://oj.leetcode.com/problems/reorder-list/题意:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this... 阅读全文
posted @ 2014-04-30 10:59 南郭子綦 阅读(3344) 评论(0) 推荐(0)