- 博客(7)
- 资源 (9)
- 收藏
- 关注
原创 Leetcode: Sort List
Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(in
2013-11-17 17:47:42 3026 3
原创 Leetcode: Insertion Sort List
Sort a linked list using insertion sort.Leetcode一直处于pengding状态无法提交,等好了再提交吧,不过应该是没问题的。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; *
2013-11-15 17:29:38 3963 2
原创 Leetcode: LRU Cache
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if
2013-11-11 20:19:25 11766 9
原创 Leetcode: Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut
2013-11-09 15:12:52 4207
原创 Leetcode: Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti
2013-11-06 23:14:11 6446 1
原创 Leetcode: Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to
2013-11-03 22:10:47 4630 1
原创 Leetcode: Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *
2013-11-02 14:57:59 2303 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人