题目:Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the ...
分类:
其他好文 时间:
2015-06-04 11:43:34
阅读次数:
124
declare -A animals=(["moo"]="cow" ["woof"]="dog")for sound in "${!animals[@]}";doecho "$sound - ${animals["$sound"]}";done
分类:
其他好文 时间:
2015-06-04 11:13:14
阅读次数:
118
grep
如果要使用正则表达式需要加上参数 grep -E "[a-z]+" #使用正则表达式
或者 egrep "[a-z]+"
-A -B 输出匹配到行前面或后面的几行 -C 则可以同时显示前后几行
-e 匹配多个样式,如 grep -e "cat" -e "dog" file
-i 忽略文本的大小写
-o 只输出文本中匹配到的文本
-c 统计匹配到的行...
分类:
系统相关 时间:
2015-06-03 21:33:49
阅读次数:
276
貌似是道水题。TLE了几次。把所有的输入输出改成scanf 和 printf ,有吧队列改成了数组模拟。然后就AC 了。2333333....Description:MR.DOG 在找工作的过程中呢。遇见了这样一个问题。有n个城市,m条小道。然后要从入度为0的点出发,出度为0的点结束,中途经过的城市...
分类:
编程语言 时间:
2015-06-02 19:32:44
阅读次数:
126
1、类加载有几种情况,怎么进行类加载答案:虚拟机加载类的途径: 1、Dog dog = new Dog();这个动作会导致常量池的解析,Dog类被隐式装载。如果当前ClassLoader无法找到Dog,则抛出NoClassDefFoundError。2、Class clazz = Class.for...
分类:
编程语言 时间:
2015-06-01 09:31:57
阅读次数:
212
父类引用指向子类对象指的是:
例如父类Animal,子类Cat,Dog。其中Animal可以是类也可以是接口,Cat和Dog是继承或实现Animal的子类。
Animal animal = new Cat();
即声明的是父类,实际指向的是子类的一个对象。
那这么使用的优点是什么,为什么要这么用?可以用这几个关键词来概括:多态、动态链接,向上转型
也有人说这是面向接口编程,可以降低程序的...
分类:
编程语言 时间:
2015-05-31 09:23:08
阅读次数:
264
一、OC中类的声明 先在Xcode中新建一个类文件,命名为Dog.h,然后按以下格式进行类的声明#import //相当于C中引入头文件@interface Dog:NSObject{}@end上面的代码中Dog后面的冒号表示继承,继承自基类NSObject,在类的声明中字段(相当于...
分类:
其他好文 时间:
2015-05-30 00:36:20
阅读次数:
200
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you aregiven...
分类:
其他好文 时间:
2015-05-28 00:17:46
阅读次数:
450
distanceTo: function(point) { var distance = 0.0; if ((this.x != null) && (this.y != null) && (point != null) && (point.x != null) && (point....
分类:
其他好文 时间:
2015-05-27 22:27:53
阅读次数:
294
还记得上次post请求的参数格式吗?
“{‘name’:dog','password':'123'}”
为什么要这么写呢?
一:网络编程,你需要一个利器抓包工具,Fiddler 这个就不错,我发现抓到的http contentType =
"application/x-www-form-urlencoded" 额,好吧,我想要的是contentType=“application/json”...
分类:
编程语言 时间:
2015-05-27 19:14:50
阅读次数:
221