【题目】
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers ...
分类:
其他好文 时间:
2014-06-05 11:14:26
阅读次数:
255
python解释器将__init__函数里的__z变量转成 _classname__z了,明白规则后外部依然可以通过实力对象来访问。
In [1]: class aa:
...: def __init__(self):
...: self.x = 10
...: self.y = 11
...: self.__z =...
分类:
编程语言 时间:
2014-06-05 10:25:10
阅读次数:
346
【题目】
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers ...
一:strtok
C/C++:char *strtok(char s[], const char *delim);
s 代表需要分割的字符串,delim代表分割的标志,参数都为比选!返回指向分割部分的指针,如果没有分割成功就返回NULL.
一个简单的例子:...
分类:
其他好文 时间:
2014-06-05 10:01:51
阅读次数:
139
【开胃小菜】
当提到python中strip方法,想必凡接触过python的同行都知道它主要用来切除空格。有以下两种方法来实现。
方法一:用内置函数
#
if __name__ == '__main__':
str = ' Hello world '
print '[%s]' %str.strip()
#
方法二:调用string模块中方法
#
import s...
分类:
编程语言 时间:
2014-06-05 09:27:48
阅读次数:
330
感知器学习算法步骤如下:
1.对权系数w置初值
对权系数w=(W1 .W2 ,…,Wn ,Wn+1 )的各个分量置一个较小的零随机值,但Wn+1 =
—g。并记为Wl (0),W2 (0),…,Wn (0),同时有Wn+1(0)=-θ 。这里Wi (t)为t时刻从第i个
输入上的权系数,i=1,2,…,n。Wn+1 (t)为t时刻时的阀值。
图1-10 感知器的分类例...
分类:
编程语言 时间:
2014-06-05 08:55:11
阅读次数:
448
如果尿布臭了,就换掉它。
1.Duplicated Code 重复代码
Extract MethodPull Up MethodForm Template Method --》 Template Method 模式Substitute Algorithm --》 函数算法替代
2.Long Method 过长的函数
“间接层”所带来的全部利益--解释能力、共享能...
分类:
其他好文 时间:
2014-06-05 08:45:40
阅读次数:
291
string defaultPath = "";
FolderBrowserDialog dialog = new FolderBrowserDialog();
//打开的文件夹浏览对话框上的描述
dialog.Description = "请选择一个文件夹";
//是否显示对话框左下角 新建文件夹 按钮,默认为 true
dialog.ShowNewFolderButton = false;
/...
分类:
其他好文 时间:
2014-06-05 08:23:34
阅读次数:
224
首先下载lxml, http://www.lfd.uci.edu/~gohlke/pythonlibs/ ,然后添加引用
from
lxml
import _elementpath
as
DONTUSE
from
lxml
import etree
具体示例:
1.添加命名空间
#set namespace
nsmap = {"xsi":
"h...
分类:
编程语言 时间:
2014-06-05 07:54:48
阅读次数:
441
用于大型程序的工具--异常处理[续2]八、自动资源释放 考虑下面函数:void f()
{
vector v;
string s;
while (cin >> s)
{
v.push_back(s);
}
string *p = new string[v.size()];
//...
delete p;
}
在正...
分类:
编程语言 时间:
2014-06-05 06:07:27
阅读次数:
393