3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three int...
分类:
编程语言 时间:
2015-06-29 23:56:35
阅读次数:
170
Function 类型函数是对象 具有属性和方法,函数名实际上是一个指向函数对象的指针没有重载;函数声明和函数表达式函数声明:function sum (num1, num2){ return num1 + num2;}函数表达式:var sum = function(num1, num2){ re...
分类:
Web程序 时间:
2015-06-29 23:49:13
阅读次数:
214
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given[0,1,2,4,5,7], return["0->2","4->5","7"].题目大意:给一个有...
分类:
其他好文 时间:
2015-06-29 23:47:05
阅读次数:
116
1 无参数情况配置URL及其视图如下:1234(r'^hello/$', hello)def hello(request): return HttpResponse("Hello World")访问http://127.0.0.1:8000/hello,输出结果为“Hello World”2 ...
分类:
Web程序 时间:
2015-06-29 23:44:40
阅读次数:
172
declare Type ref_cur_emp IS REF CURSOR RETURN scott.emp%RowType; cur_emp ref_cur_emp; rec_emp cur_emp%RowType; v_sql varchar2(100) := 'sel...
分类:
数据库 时间:
2015-06-29 23:43:51
阅读次数:
183
int gcd(int a, int b){return (a = a % b) ? gcd (b,a): b;}int lcm(int a, int b){return a * b / gcd(a, b);}
分类:
编程语言 时间:
2015-06-29 23:33:09
阅读次数:
132
CREATE OR REPLACE PACKAGE BODY temp_package_demo is FUNCTION f_demo(userid NUMBER) RETURN BOOLEAN IS v_temp varchar2(1); BEGIN SEL...
分类:
数据库 时间:
2015-06-29 23:32:34
阅读次数:
152
// 统计一个数二进制中的1的个数
#include
int count(int a)
{
int count = 0;
while (a)
{
count++;
a = a & (a - 1);
}
return count;
}
int main()
{
printf("%d\n", count(10));
printf("%d\n", count(0));
...
分类:
编程语言 时间:
2015-06-29 22:18:18
阅读次数:
126
// 求两个数中不同的位的个数
#include
int dcount(int a,int b)
{
int count = 0;
int num = a ^ b;
while (num)
{
count++;
num = num & (num - 1);
}
return count;
}
int main()
{
printf("%d\n", dcount(3,...
分类:
编程语言 时间:
2015-06-29 22:17:31
阅读次数:
136
// 判断一个数是不是2的n次方
#include
void judge_n(int a)
{
int b = a - 1;
if ((a & b) == 0)
{
printf("是2的n次方\n");
return;
}
else
{
printf("不是2的n次方\n");
return;
}
}
int main()
{
judge_n(2);
...
分类:
编程语言 时间:
2015-06-29 22:16:09
阅读次数:
181