题目链接Givennpairs of parentheses, write a function to
generate all combinations of well-formed parentheses.For example, givenn= 3, a
solution set is:"((...
分类:
其他好文 时间:
2014-06-09 15:11:33
阅读次数:
212
同是递归简单题public class Solution { public boolean
isSameTree(TreeNode p, TreeNode q) { boolean flag = true; if(p == null
&& q == null) ...
分类:
其他好文 时间:
2014-06-09 13:46:23
阅读次数:
275
题目链接题意:给出长度为n的数组,和整数elem, 要求删除数组中存在的elem,返回最终的数组长度。附上代码:
1 class Solution { 2 public: 3 int removeElement(int A[], int n, int elem) { 4
//...
分类:
其他好文 时间:
2014-06-09 13:38:05
阅读次数:
190
第一种方法,暴力求解,从当前向左右两个方向扫描比自己小的,然后计算面积,时间复杂度O(n^2)code如下,但是在LeetCode上回超时。
1 class Solution { 2 public: 3 int largestRectangleArea(vector &height) {
4...
分类:
其他好文 时间:
2014-06-08 21:24:07
阅读次数:
328
题目
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n)
space is pretty straight forward. Cou...
分类:
其他好文 时间:
2014-06-08 15:32:45
阅读次数:
245
题目
Given a collection of integers that might contain duplicates, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not c...
分类:
其他好文 时间:
2014-06-08 05:32:21
阅读次数:
196
题目
Given a set of distinct integers, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.
...
分类:
其他好文 时间:
2014-06-08 04:01:05
阅读次数:
240
Implement wildcard pattern matching with support for '?' and '*'.public class Solution {
public boolean isMatch(String s, String p) {
if (s == null || p == null) return false;
if (...
分类:
编程语言 时间:
2014-06-08 03:10:46
阅读次数:
216
大约是在2008年的时候开始接触Ubuntu系统,一开始被它吸引是因为它各种神奇的桌面特效。然后一直使用到现在,现在将使用中遇到的各种小问题的解决办法整理出来。希望对刚接触但同样爱好Ubuntu的朋友们有所帮助。1密码恢复2QQ掉线3开机自动挂载硬盘分区4修改软件源5软件相关6防..
分类:
其他好文 时间:
2014-06-08 02:36:47
阅读次数:
319
23***文件名带空格的文件把文件名中间的空格加双引号。例:rmmy"空格"file 进入或者执行文件名带空格文件的命令格式也一样 24更改MAC地址00:1a:73:d7:3b:e2sudoifconfigeth2downsudoifconfigeth2hwetherXX:XX:XX:XX:XX:XXsudoifconfigeth2up以上修改重启后会失效,若要永久..
分类:
其他好文 时间:
2014-06-08 02:29:05
阅读次数:
312