Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:
其他好文 时间:
2015-07-29 11:40:57
阅读次数:
126
1、OnClientClick="return confirm('确定要删除吗?')2、自定义函数: 函数: 调用: 效果:
分类:
Web程序 时间:
2015-07-29 11:37:31
阅读次数:
165
public sealed class Person : System.IComparable {
internal int age;
public int CompareTo(object rhs) {
if (this == rhs) return 0; // 相同
Person other = (Person)rhs; ...
分类:
其他好文 时间:
2015-07-29 10:19:29
阅读次数:
143
谜题01: 奇数性
下面方法的目的是确定其唯一的参数是否为奇数。这个方法可行吗?
public static bool IsOdd(int i)
{
return i % 2 == 1;
}
解惑01: 奇数性
奇数可定义为被2整除余数为1的整数。表达式i%2计算的是i除以2时所产生的余数,因此看起来这个程序应该可行。遗...
1 for in循环:使用它时,要主要遍历的是所有可枚举的属性(实例以及原型中的属性)function Person(name){ this.name = name;}Person.prototype.getName=function(){ return this.name;}var p...
分类:
编程语言 时间:
2015-07-29 08:58:42
阅读次数:
118
【056-Merge Intervals(区间合并)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[...
分类:
编程语言 时间:
2015-07-29 07:56:58
阅读次数:
153
【054-Spiral Matrix(螺旋矩阵)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,
Given the foll...
分类:
编程语言 时间:
2015-07-29 07:56:30
阅读次数:
172
while:break:提前退出循环continue:提前结束循环,而进入下一轮循环while:;do********done(死循环)函数:function代码重复使用,结构化,不能单独运行,需要被调用时才可以被使用1.function函数名{2.function(){******************}}return#:自定义返回值OS=kernel(..
分类:
系统相关 时间:
2015-07-29 06:46:40
阅读次数:
205
代码块对象: 通常称:代码块,是对C语言的扩展,,除了函数中的代码,其害包含变量绑定。代码块有时也被称为闭包(closure)。两种绑定类型:自动型和托管型。自动型使用的是栈中的内存,而托管绑定是通过堆创建的。代码块和函数指针: 代码块特征:1.返回类型可以手动声明也可..
分类:
其他好文 时间:
2015-07-29 06:37:03
阅读次数:
113
点击打开链接
用线段树方式建树 [ 0, n]
已知[ l, r] 结点 求n
若 建一个[0, 2*r] 的线段树 这是的总点数的奇的,(左子树!=右子树
[0, r] 在左子树里 则n最大为2*r
若 建一个[0, 2*r+1] 的线段树 (左子树==右子树
[0, r] 在左子树里 这时则 [0, r] 就可以建树
所以搜的时候超出2*r 就直接return
#inc...
分类:
其他好文 时间:
2015-07-29 01:10:34
阅读次数:
355