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 ...
分类:
其他好文 时间:
2014-09-20 10:07:27
阅读次数:
162
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
Note: Recursive solut...
分类:
其他好文 时间:
2014-09-19 17:42:05
阅读次数:
158
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursive soluti...
分类:
其他好文 时间:
2014-09-19 17:40:15
阅读次数:
177
估计80%以上接触互联网的人都知道bt是什么东西,任何一个用bt下载的人都知道这样一个概念,种子。bt种子就是记录了p2p对等网络中tracker, nodes, files等信息,也就是说,这个种子告诉你,你要下载什么,到哪里下载。bt种子文件有自己的文件格式,下面简单看看bt种子文件的结构。.....
分类:
其他好文 时间:
2014-09-18 18:41:44
阅读次数:
180
题目:
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
刷题打卡中...
分类:
其他好文 时间:
2014-09-18 16:33:24
阅读次数:
205
Problem DescriptionYou are given a tree with N nodes which are numbered by integers 1..N. Each node is associated with an integer as the weight.Your t...
分类:
其他好文 时间:
2014-09-18 16:03:14
阅读次数:
325
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2-...
分类:
其他好文 时间:
2014-09-18 05:24:13
阅读次数:
195
题目:
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
AC率第二高的题啦,二项树的最长路径。初看此题...
分类:
其他好文 时间:
2014-09-17 20:26:52
阅读次数:
162
题目不难,但是容易出错,需要考虑各种边界情况
非递归代码如下:
ListNode *reverseKGroup(ListNode *head, int k) {
if (head == NULL || k <= 1) return head;
ListNode * start = NULL, * end = NULL, *newHead = NULL, *p...
分类:
其他好文 时间:
2014-09-16 19:00:54
阅读次数:
201
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le...
分类:
编程语言 时间:
2014-09-16 18:48:00
阅读次数:
242