javascript中的replace只会替换第一个匹配如果要全部替换的话只能重写方法实现replaceAll记录一下String.prototype.replaceAll
= function (s1, s2) { return this.replace(new RegExp(s1,"gm"),s...
分类:
编程语言 时间:
2014-05-26 10:49:03
阅读次数:
326
原题地址:https://oj.leetcode.com/problems/same-tree/题意:判断两棵树是否是同一棵树。解题思路:这题比较简单。用递归来做。首先判断两个根节点的值是否相同,如果相同,递归判断根的左右子树。代码:#
Definition for a binary tree n....
分类:
编程语言 时间:
2014-05-26 10:30:17
阅读次数:
289
原题地址:https://oj.leetcode.com/problems/symmetric-tree/题意:判断二叉树是否为对称的。Given
a binary tree, check whether it is a mirror of itself (ie, symmetric around ...
分类:
编程语言 时间:
2014-05-26 10:18:52
阅读次数:
293
近日在做项目时遇到非必现crush,具体异常信息为:// Short Msg:
java.lang.IllegalStateException// Long Msg: java.lang.IllegalStateException: The
content of the adapter has ch...
分类:
移动开发 时间:
2014-05-26 10:08:36
阅读次数:
590
原题地址:https://oj.leetcode.com/problems/n-queens/题意:经典的N皇后问题。解题思路:这类型问题统称为递归回溯问题,也可以叫做对决策树的深度优先搜索(dfs)。N皇后问题有个技巧的关键在于棋盘的表示方法,这里使用一个数组就可以表达了。比如board=[1,
...
分类:
编程语言 时间:
2014-05-26 10:07:52
阅读次数:
274
备忘:1.C函数参数为字符串char*。如果是入参,对应C#中string或StringBuilder;如果是出参对应C#中StringBuider;2.C函数参数为结构体指针,需在C#中对应定义结构体。如果是入参,C#中可为myfunction(MyStruct
mystruct)或myfunct...
分类:
其他好文 时间:
2014-05-26 10:06:56
阅读次数:
158
1.PHP和js同样是弱类型的语言 字符串的截取php中: $str ="hello world!";
substr($str,1,2);//从字符串的下标为1的地方截取2个字符, eljs中 var str = "hello world!";
str.substring(1,2);//e ...
分类:
其他好文 时间:
2014-05-26 09:55:57
阅读次数:
243
linux中用shell获取昨天、明天或多天前的日期:在Linux中对man date -d
参数说的比较模糊,以下举例进一步说明:# -d, --date=STRING display time described by STRING, not
`now’[root@Gman root]# dat...
分类:
系统相关 时间:
2014-05-26 09:42:15
阅读次数:
320
变量定义(variables):local: time or _time instance:
@time class: @@time global $time数据类型(data types)Numeric String Symbol Boolean
Array Hashvariabl...
分类:
其他好文 时间:
2014-05-26 09:39:54
阅读次数:
217
from __future__ import print_functionfrom types
import NoneType__author__ = "Shamim Hasnath"__copyright__ = "Copyright 2013,
Shamim Hasnath"__license_...
分类:
编程语言 时间:
2014-05-26 09:29:50
阅读次数:
495