//求旋转数组的最小数字,输入一个递增排序的数组的一个旋转,输出其最小元素
#include
#include
int find_min(int arr[],int len)
{
int i = 0;
for (i = 1; i < len; i++)
{
if (arr[i] < arr[0])
return arr[i];
}
return arr[0];
}
int ...
分类:
编程语言 时间:
2015-07-07 14:46:27
阅读次数:
117
又写了一次splay 感觉更有体会 速度居然又卡进了首页。。这题要注意初始值应为-inf(mx和v)#include#include#include#include#include#define rep(i,l,r) for(int i=l;is; if(k==1) return -1...
分类:
其他好文 时间:
2015-07-07 14:33:48
阅读次数:
183
1. if(username.equals(“zxx”)){} 这样写的话,如果username是null, 则会报NullPointerException,所以先要判断username是否为null.2. int x = 1; return x==1?true:false; 不会报错,但特别啰嗦....
分类:
编程语言 时间:
2015-07-07 14:33:31
阅读次数:
142
箭头函数箭头函数使用=>语法来简化函数,在语句结构上和C#、Java 8 和 CoffeeScript类似,支持表达式和函数体。。=>`操作符左边为输入的参数,而右边则是进行的操作以及返回的值。var sum = (num1, num2) => num1 + num2;
// 等同于
var sum = function(num1, num2) {
return num1 + num2;
}...
分类:
其他好文 时间:
2015-07-07 13:01:23
阅读次数:
119
Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m...
分类:
其他好文 时间:
2015-07-07 12:48:06
阅读次数:
128
create function 函数名 (@pno int) returns int as begin declare @a int if not exists(select * from person where pno=@pno) set @a=-1 else set @a=1 return @...
分类:
数据库 时间:
2015-07-07 12:41:44
阅读次数:
134
首先看下Prototype里的写法:var Class = { create: function() { return function() { this.init.apply(this, arguments); } } } var A = Class.create(); A.prototype =...
分类:
Web程序 时间:
2015-07-07 12:30:38
阅读次数:
123
Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m...
分类:
其他好文 时间:
2015-07-07 12:22:55
阅读次数:
113
题解:
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9...
分类:
编程语言 时间:
2015-07-07 09:39:22
阅读次数:
109
题目:
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,...
分类:
其他好文 时间:
2015-07-07 09:38:19
阅读次数:
127