Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
思路:
简而言之,要实现的就是BigInteger(a).Multiply(BigInteger(b))的功能,但很显然,leetcode中不让用BigInteger...
分类:
其他好文 时间:
2015-06-30 18:20:21
阅读次数:
95
题目:Summary RangesGiven 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->...
分类:
其他好文 时间:
2015-06-30 18:10:08
阅读次数:
102
先来段官方文档压压惊。。property(fget=None, fset=None, fdel=None, doc=None)Return a property attribute.fget is a function for getting an attribute value, likewise...
分类:
编程语言 时间:
2015-06-30 18:01:49
阅读次数:
111
表的列名比较多的时候,手工一个个的写列名比较麻烦,这个函数可以让人偷偷懒create or replace function f_GetCols(p_TableName in varchar2/*获取表中所有列名 前后添加select from*/) RETURN varchar2isResult ...
分类:
数据库 时间:
2015-06-30 17:49:58
阅读次数:
153
//给?组组数,只有两个数只出现了一次,其他所有数都是成对出现的,找出这两个数。
#include
int find_one_pos(int num) //找一个为为1的位置
{
int n = 0;
while(num)
{
if (num & 1 == 1)
break;
else
{
n++;
num >>= 1;
}
}
return...
分类:
编程语言 时间:
2015-06-30 16:22:48
阅读次数:
105
//不使用循环和判断语句,求出1-100之间所有数的和
#include
int fun(int n, int *sum)
{
*sum = *sum + n;
(n--) && (fun(n, sum));
return n;
}
int main()
{
int n = 100;
int sum = 0;
fun(n, &sum);
printf("%d\n", sum);
...
分类:
编程语言 时间:
2015-06-30 16:21:31
阅读次数:
123
// 不用大与小与号,求两数最大值
#include
int max(int a, int b)
{
int c = a - b;
int d = 1 << 31;
if ((c&d) == 0)
{
return a;
}
else
{
return b;
}
}
int main()
{
printf("%d是大数\n", max(0, 2));
prin...
分类:
编程语言 时间:
2015-06-30 16:21:30
阅读次数:
110
// 编写一个函数,这个函数可以将一个整数的指定位置1或置0
#include
int set_bit(int a, int pos, int flag)
{
int b = 1 << (pos - 1);
if (flag == 0)
{
a &= ~b;
}
else
{
a |= b;
}
return a;
}
int main()
{
printf("...
分类:
编程语言 时间:
2015-06-30 16:21:06
阅读次数:
139
// 求绝对值
#include
int fabs(int a)
{
if (a < 0)
{
a = ~a + 1;
}
return a;
}
int main()
{
printf("绝对值是:%d\n", fabs(5));
printf("绝对值是:%d\n", fabs(0));
printf("绝对值是:%d\n", fabs(-1));
return...
分类:
编程语言 时间:
2015-06-30 16:20:51
阅读次数:
106
// 将正数变成对应的负数,将负数变成对应的正数
#include
int turn(int a)
{
if (a <= 0)
{
a = ~a + 1;
}
else
{
a = (a ^ 0xffffffff) + 1;
}
return a;
}
int main()
{
printf("%d\n", turn(5));
printf("%d\n", tu...
分类:
编程语言 时间:
2015-06-30 16:20:29
阅读次数:
152