一个简单的迭代器示例
--迭代工厂函数
function value(t)
local i = 0;
return
function()
i = i+1;
return t[i];
end;
end;
t = {10,20,30};
iter = va...
分类:
其他好文 时间:
2014-05-10 08:36:53
阅读次数:
268
今天又个兄弟求助,数据库里一个表有数据如下:
no name
1 a
2 b
3 c
4 d
如何用一个sql显示如下结果:
ab
ac
ad
bc
bd
cd
对于这种构造数据,是分析函数的强项,下面来做个试验:
create table t (no number,name varchar(2));
insert into t va...
分类:
其他好文 时间:
2014-05-07 08:03:17
阅读次数:
447
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gr...
分类:
其他好文 时间:
2014-05-07 06:10:17
阅读次数:
370
【Question】
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the p...
分类:
其他好文 时间:
2014-05-07 04:17:18
阅读次数:
259
题目:
在数轴上有n个区间,每个区间都是连续的整数区间。现在要在数轴上任取一堆元素,构成一个集合V,要求每个区间和V的交集至少有两个不同的元素。求V的最小的元素个数。
问题分析:
可以使用贪心算法,最终结果肯定是小于大于2×n的,如果两个集合之间有相同的元素,那么选相同的元素必然会使结果更小,当我们以e排序后,如果有相同的必然是最后的元素。所以贪心的策略就是如果一个区间最...
分类:
其他好文 时间:
2014-05-07 04:04:23
阅读次数:
294
这几天搞了一下Oracle数据库,可能用sql server习惯了,感觉好不方便。PL的界面友好度比sql server差远了 ,既然都收购了PL了
为什么不给它做好一点呢?各种不便。郁闷
向Oracle服务器插入一条数据
--不管什么格式通通用''引号引起来。不过INTEGER格式的还是别用引号
insert into T_SITE VALUES(
8, --注意主键别与表里的其他主键冲...
分类:
数据库 时间:
2014-05-07 03:24:59
阅读次数:
319
For a given positive integer n, please find the smallest positive integer x that we can find an integer y such that y^2 = n +x^2.
Input
The first line is an integer T, which is the the...
分类:
其他好文 时间:
2014-05-06 19:21:10
阅读次数:
290
项目中用到了地图相关的东西,就把以前的demo搬了出来,结果发现直接运行之前的demo没有问题,在xcode5下新建项目再把代码粘贴过来就会提示
May 5 11:36:21 infomedia-iPod-touch TestLocation[1465] : CGBitmapContextCreate: unsupported parameter combination: 5 integer ...
分类:
移动开发 时间:
2014-05-06 15:17:46
阅读次数:
769
--oracle实现自增id
--创建一张T_StudentInfo表
create table T_StudentInfo
(
"id" integer not null primary key,
xsName nvarchar2(120) not null,
xsAge integer not null,
Mobile varchar(...
分类:
数据库 时间:
2014-05-06 15:04:22
阅读次数:
525
一次通过,它的spoiler里面的提示有两个:1. 末尾为0的情况,这个考虑到了2.Did you
notice that the reversed integer might overflow? Assume the input is a 32-bit
integer, then the reve...
分类:
其他好文 时间:
2014-05-06 11:10:45
阅读次数:
356