Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas...
分类:
其他好文 时间:
2014-06-30 12:05:08
阅读次数:
269
本系列所有文章可以在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873
接上文...
分类:
其他好文 时间:
2014-06-30 11:09:33
阅读次数:
281
【题目】
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 {1,4,2,3}.
【题意】
给定一个链表L: L0→L1→…→Ln-1→Ln,对他重新排序成L...
分类:
其他好文 时间:
2014-06-30 10:11:14
阅读次数:
158
【题目】
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 solution is trivial, could you do it iteratively?
【题意】
非递归实现后续遍...
分类:
其他好文 时间:
2014-06-30 10:10:10
阅读次数:
177
数据项中引入模型/视图架构,可以方便的将数据与表现层分开。
-------------------------------------
为每个视图都提供了一个默认的委托——可以使用自定义的委托来替换显示没一项,并为可编辑项提供一个合适的编辑器。
-------------------------------------
模型:用于存储数据项(data item)。
纯粹的视图部件:Q...
分类:
其他好文 时间:
2014-06-30 09:39:25
阅读次数:
1128
【题目】
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 solution is trivial, could you do it iteratively?
【题意】
非递归返回先序遍历...
分类:
其他好文 时间:
2014-06-30 06:21:18
阅读次数:
334
【题目】
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.
Return all such possible sentences.
For example, given
s = "catsanddog",
dict = ["cat", "cats", "and", "sand", "dog...
分类:
其他好文 时间:
2014-06-30 00:51:41
阅读次数:
295
题目
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence...
分类:
其他好文 时间:
2014-06-29 22:16:48
阅读次数:
239
An iterative way of writing quick sort:#include #include #include using namespace std;void quickSort(int A[], int n) { stack> stk; stk.push(make_pair(...
分类:
其他好文 时间:
2014-06-29 20:16:45
阅读次数:
179
We must have already been familiar with proprietary Fortran programming environments, for example,Compaq Visual Fortran IDE (which is actually a combi...