Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w ...
分类:
其他好文 时间:
2016-09-22 06:35:53
阅读次数:
178
题意: Implement int sqrt(int x). Compute and return the square root of x.(Medium) 分析: 二分搜索套路题,不能开方开尽的时候,取结果整数位。 注意:判定条件中,用x / mid == mid而不是 mid * mid == ...
分类:
其他好文 时间:
2016-09-22 01:07:30
阅读次数:
172
问题: Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have ...
分类:
其他好文 时间:
2016-09-22 01:07:19
阅读次数:
169
functioncolorRandom1(){ varr=Math.floor(Math.random()*51+200); varg=Math.floor(Math.random()*51+200); varb=Math.floor(Math.random()*51+200); return‘rgb(‘+r+‘,‘+g+‘,‘+b+‘)‘; } vardiv=document.body.getElementsByTagName(‘div‘)[0]; div.style.background=colo..
分类:
其他好文 时间:
2016-09-21 23:44:04
阅读次数:
218
公园里有一些桃子,猴子每天吃掉一半,扔掉一个烂的,第6天的时候发现剩余1个,问一开始有多少个桃子1、var sy=1;for(i=0;i<6;i++){ sy=(sy+1)*2; }2.递归算法: function ShuLiang(n){ if(n==6) { return 1; } var sl ...
分类:
编程语言 时间:
2016-09-21 23:12:43
阅读次数:
280
let a = function(){ var i=0; let b = function(){ i++; alert(i); } return b; } let c = a(); c(); 这段代码有两个特点: 1、函数b嵌套在函数a内部; 2、函数a返回函数b。 这样在执行完var c=a()后 ...
分类:
Web程序 时间:
2016-09-21 23:01:19
阅读次数:
203
/** *结束日期与开始日期之间的间隔天数 *return 两个日期之间的天数 */ private Long dateTest(String startDate, String endDate) throws ParseException { Date start = new Date(); Da ...
分类:
其他好文 时间:
2016-09-21 15:55:27
阅读次数:
108
//Person package zuoye; public class Person { private String name,address,telphone,email; public String getName() { return name; } public void setName ...
分类:
其他好文 时间:
2016-09-21 14:29:34
阅读次数:
740
/** * 对字符串做预处理 * \s 匹配空格、制表符、换页符等空白字符 */ public static String pretreatString(String str) { return str.replaceAll("\\s*", ""); } ...
分类:
其他好文 时间:
2016-09-21 11:39:47
阅读次数:
125
/** * 判断对象是否为空 */ public static boolean isEmpty(Object obj) { if (obj == null) return true; if (obj instanceof String) return StringUtils.isEmptyOrWhi ...
分类:
其他好文 时间:
2016-09-21 11:37:11
阅读次数:
761