public class Solution { public int numTrees(int n) { int[] dp=new int[n+1]; dp[0]=1; dp[1]=1; for(int i=2;i<=n;i++) for(int j=1;j<=i;j++) ... ...
分类:
其他好文 时间:
2017-09-29 10:07:22
阅读次数:
120
public class Solution { public boolean isValidBST(TreeNode root) { Stack stack=new Stack(); TreeNode cur=null; while(root!=null||!stack.isEmpty()) { .... ...
分类:
其他好文 时间:
2017-09-29 10:06:11
阅读次数:
131
class Solution { public List generateTrees(int n) { if(n==0) return new ArrayList(); return generateTrees(1, n); } private List generateTrees(int i, i... ...
分类:
其他好文 时间:
2017-09-29 09:56:57
阅读次数:
140
public class Solution { public List inorderTraversal(TreeNode root) { List res=new ArrayList(); Stack stack=new Stack(); while(root!=null||!stack.isEm... ...
分类:
其他好文 时间:
2017-09-29 09:56:30
阅读次数:
116
Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the d ...
分类:
其他好文 时间:
2017-09-29 09:52:50
阅读次数:
172
Given A binary Tree, how do you remove all the half nodes (which has only one child)? Note leaves should not be touched as they have both children as ...
分类:
其他好文 时间:
2017-09-29 09:52:12
阅读次数:
156
国内使用NPM,最好设置国内镜像源 修改C:\users\[用户名]下的.npmrc文件: registry=https://registry.npm.taobao.org/distury=https://npm.taobao.org/distsass-binary-site=https://npm ...
分类:
其他好文 时间:
2017-09-29 01:40:09
阅读次数:
122
第一单元用student用户登录系统图形界面打开一个bash修改student的密码,把密码更新成。。。。显示当前系统时间显示当前系统时间,显示格式为:“小时:分钟:秒AM/PM”显示“usr/bin/clean-binary-files”的文件类型统计“usr/bin/clean-binary-files”的文件大小用快捷方式在..
分类:
其他好文 时间:
2017-09-29 00:11:15
阅读次数:
156
题意:给定一个01矩阵,问你能画出几条回路,使得包含所有的1。 析:一个插头DP,dp[i][j][s] 表示转移到 (i, j) 这个格子,状态为 s 时的方案数,然后逐格递推。对于每个格子要么有0个插头要么有2个。 代码如下: ...
分类:
其他好文 时间:
2017-09-28 21:37:23
阅读次数:
241
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: //如果有子节点,字符串随着递归一直累加,直到没 ...
分类:
其他好文 时间:
2017-09-28 14:45:14
阅读次数:
161