Given a binary tree containing digits
from0-9only, each root-to-leaf path could represent a number.An example is the
root-to-leaf path1->2->3which rep...
分类:
其他 时间:
2014-02-06 17:06:58
收藏:
0 评论:
0 赞:
0 阅读:
393
构造法生成随机数
顾名思义构造法就是要预先设定好数组的成员,一般都希望数组成员的分布是均匀的,所以要包括所有元素,并且元素个数相等。就现在的文件体系,最小单位是字节,一个字节等于8位二进制数。数组元素有256个字节,字节数值从
0到 255。这样构造的数组长度应该是256的倍数。 构造好的数组要想过...
分类:
其他 时间:
2014-02-06 17:08:38
收藏:
0 评论:
0 赞:
0 阅读:
349
策略模式实现起来很其实简单,主要在于策略抽象采用抽象类还是协议的决策。在这里我个人比较倾向采用抽象类,严格来说OC没有抽象类,所以可以采用“默认实现类”,只要让策略子类来覆盖它就可以了。也就是说这个策略抽象当中的方法相当于java/C#里的virtual方法。由于这种不严格性,就没有必要考虑协议改变...
分类:
其他 时间:
2014-02-06 17:05:18
收藏:
0 评论:
0 赞:
0 阅读:
297
cd /usr/share/selinuxsetenforce 0tar -xvf
MySQL-5.6.12-1.el6.x86_64.rpm-bundle.tarrpm -qa|grep -i mysqlyum -y remove
mysql-libs*rpm -e mysql*rpm -ivh ...
分类:
数据库技术 时间:
2014-02-06 17:02:48
收藏:
0 评论:
0 赞:
0 阅读:
512
1 public class Solution { 2 public boolean
isValidBST(TreeNode root) { 3 return
is(root,Integer.MAX_VALUE,Integer.MIN_VALUE); 4 } 5 public boolean is(...
分类:
其他 时间:
2014-02-06 17:00:18
收藏:
0 评论:
0 赞:
0 阅读:
349
Suppose a sorted array is rotated at some pivot
unknown to you beforehand. 1 public class Solution { 2 //all is equal in sorted
array 3 public int sea...
分类:
其他 时间:
2014-02-06 16:59:28
收藏:
0 评论:
0 赞:
0 阅读:
405
HWND GetHwndByPid(DWORD dwProcessID) { HWND h =
GetTopWindow(0); HWND retHwnd = NULL; while ( h ) { DWORD pid = 0; DWORD
dwTheardId = GetWindowThreadP...
分类:
其他 时间:
2014-02-06 16:58:38
收藏:
0 评论:
0 赞:
0 阅读:
311
1 public class Solution { 2 public int sqrt(int
x) { 3 if(x==0 ||x==1) return x; 4 long start = 1; 5 long end = x-1; 6
while(startx){11 end = mid-1;12...
分类:
其他 时间:
2014-02-06 16:57:48
收藏:
0 评论:
0 赞:
0 阅读:
418
本章节主要Jquery选择器jquery选择器与css选择器十分相似,特别需要注意的是$("#tt")获取的永远是对象,即使没有此元素也不会报错,同理错if($("#tt")){//代码}对if($("#tt").length>0){//代码}或者转换为DOM对象也是对的if($("#tt")[0]...
分类:
Web开发 时间:
2014-02-06 16:56:08
收藏:
0 评论:
0 赞:
0 阅读:
397
1 public class Solution { 2 public ArrayList
anagrams(String[] strs) { 3 int len = strs.length; 4 HashMap> hm = new
HashMap>(); 5 ArrayList res = new ...
分类:
其他 时间:
2014-02-06 16:56:58
收藏:
0 评论:
0 赞:
0 阅读:
415
Given a binary tree and a sum, determine if the
tree has a root-to-leaf path such that adding up all the values along the path
equals the given sum.Fo...
分类:
其他 时间:
2014-02-06 16:55:18
收藏:
0 评论:
0 赞:
0 阅读:
377
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST. 1 public class Solution {
2 public TreeNode sortedAr...
分类:
其他 时间:
2014-02-06 16:53:38
收藏:
0 评论:
0 赞:
0 阅读:
541
一.man page的时候很多符号进行说明. []:表示可选参数 :表示必选参数
a|b|c:表示多选一 ...:表示可以多个选项连接 另外凡是大写字母拼写的单词都应知道在man page下会有相应的参数来替换的.如果man
date的时候有: date [OPTIONS]...[+FORMATS]...
分类:
其他 时间:
2014-02-06 16:54:28
收藏:
0 评论:
0 赞:
0 阅读:
383
Given a set ofnon-overlappingintervals, insert
a new interval into the intervals (merge if necessary).You may assume that the
intervals were initially...
分类:
其他 时间:
2014-02-06 16:51:58
收藏:
0 评论:
0 赞:
0 阅读:
482
The set[1,2,3,…,n]contains a total ofn! unique
permutations.By listing and labeling all of the permutations in order,We get the
following sequence (ie...
分类:
其他 时间:
2014-02-06 16:52:48
收藏:
0 评论:
0 赞:
0 阅读:
314
1 public class Solution { 2 public double
pow(double x, int n) { 3 if(x==0||x==1) return x; 4 if(n<0)return
1/helper(x,-1*n); 5 else return helper(x,n...
分类:
其他 时间:
2014-02-06 16:51:08
收藏:
0 评论:
0 赞:
0 阅读:
414
1 public class Solution { 2 public void
setZeroes(int[][] matrix) { 3 boolean row = false; 4 boolean col = false; 5
for(int i=0;i<matrix.length;i++){ ...
分类:
其他 时间:
2014-02-06 16:50:18
收藏:
0 评论:
0 赞:
0 阅读:
324
1 public class Solution { 2 public
ArrayList> levelOrder(TreeNode root) { 3 ArrayList> res = new
ArrayList>(); 4 LinkedList cur = new LinkedList(); 5 ...
分类:
其他 时间:
2014-02-06 16:49:28
收藏:
0 评论:
0 赞:
0 阅读:
338
1 public class Solution { 2 public ArrayList
inorderTraversal(TreeNode root) { 3 ArrayList res = new ArrayList (); 4 Stack
stack = new Stack(); 5 Tree...
分类:
其他 时间:
2014-02-06 16:48:38
收藏:
0 评论:
0 赞:
0 阅读:
438
Given two wordsword1andword2, find the minimum
number of steps required to convertword1toword2. (each operation is counted as 1
step.)You have the fol...
分类:
其他 时间:
2014-02-06 16:46:58
收藏:
0 评论:
0 赞:
0 阅读:
372