一、定义max函数模板 //basics/mas.hpp
temeplate
inline T const& max (T const& a, T const& b)
{ return a //temeplate
模板max()的另一种等价定义
temeplate inline T const& m...
分类:
编程语言 时间:
2015-06-09 06:04:33
阅读次数:
156
给页面元素绑定了一个click事件用来触发ajax请求,在安卓微信自带浏览器中和IE6下,请求时常会被中断,返回错误类型“abort”,在其他浏览器中都一切正常。
在IE6中使用Fiddler2和httpWatch监视请求,经常会出现”aborted”,折腾特么一个周末,。。。。。
不说废话了....
解决办法:在标签上加上onclick='return false;'...
分类:
微信 时间:
2015-06-09 01:01:57
阅读次数:
635
题目来自于Leetcode
https://leetcode.com/problems/pascals-triangle/
Given numRows, generate the first numRows of Pascal's triangle.
For example, given numRows = 5,
Return
[
[1],
[1,1],...
分类:
其他好文 时间:
2015-06-09 00:57:01
阅读次数:
158
题目:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4...
分类:
其他好文 时间:
2015-06-09 00:51:13
阅读次数:
122
一、闭包1. 1 function f1(){ 2 var n=999; 3 nAdd=function(){n+=1} 4 function f2(){ 5 alert(n); 6 } 7 return f2; 8 } 9 var res...
分类:
编程语言 时间:
2015-06-09 00:45:54
阅读次数:
136
题目:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onl...
分类:
其他好文 时间:
2015-06-09 00:45:04
阅读次数:
115
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr...
分类:
其他好文 时间:
2015-06-09 00:44:40
阅读次数:
115
1. 堆算法Top,时间复杂度 O(LogN)function top(arr,comp){if(arr.length == 0){return ;}var i = arr.length / 2 | 0 ;for(;i >= 0; i--){if(comp(arr[i], arr[i * 2])){...
分类:
编程语言 时间:
2015-06-08 23:06:17
阅读次数:
237
lambda 表达式1. lambda 表达式基础"Python支持一种有趣的语法,它允许你快速定义单行的最小函数。这些叫做lambda的函数,是从Lisp借用来的,可以用在任何需要函数的地方。" Ref[1] 1 >>> def f(x): 2 ... return x*2 3 ... ...
分类:
编程语言 时间:
2015-06-08 23:02:55
阅读次数:
210
public static void insertSort(int[] a){
if(a == null){
return;
}
int n = a.length;
int j = 0;
for(int i=1; itemp这个条件别忘了
for(j=i-1; j>=0 &&...
分类:
编程语言 时间:
2015-06-08 21:39:46
阅读次数:
155