这道题一开始无从下手,想到找到用hashtable,这样查询没个数是否在List中只需要O(1)时间。以上是第一步, 接下来的想法就比较自然, 将每个数都当成可能的起始点进行测试。待测试的起始点为n,如果n-1在set中,则n必不为起始数字,可以continue优化运行时间代码中使用set来实现ha...
分类:
其他好文 时间:
2015-07-07 10:50:22
阅读次数:
120
public class Solution { public List> threeSum(int[] nums) { //本题需要对重复数字进行考虑,主要涉及以下几处: //1.外层循环时,需要与前一个数进行比较,如果重复,使用 if 和continue ...
分类:
其他好文 时间:
2015-07-07 00:37:35
阅读次数:
140
跳转语句:break;跳出的意思,如果在循环语句中使用则是跳出循环default,通常与 switch case 配合使用continue继续return返回值异常语句:try-catch-finally保护程序,在出错的情况下也不会终止try //快捷键:try后双击Tab键{ 要执行的代码...
分类:
其他好文 时间:
2015-07-05 23:43:29
阅读次数:
166
使用游标双层嵌套对总表进行拆分为帖子表和恢复表----------
注意点:
(1)进行拆分的总表表名是不同的,所以创建临时表,把总表的数据先插入临时表
(2)为了避免最外层游标轮询数据结束时,抛出 not found 退出程序,不会执行关闭游标等后续操作,定义continue handler, declare continue handler for not found set done1=1;...
分类:
数据库 时间:
2015-07-03 12:33:05
阅读次数:
244
(1)break;是跳出整个循环 (2)continue是继续循环 语句结构 for(初始条件;判断条件;循环后条件值更新){
????if(特殊情况)
????{continue;}
????循环代码
}...
分类:
编程语言 时间:
2015-07-02 19:41:23
阅读次数:
135
#!/usr/bin/python
a="a.txt"
f=file(a)
c=f.readlines()
whileTrue:
user_input=raw_input("plzinputyourname:").strip()
iflen(user_input)==0:continue
forlineinc:
ifuser_inputinline:
printline,
break
else:
print"itisnottheuser"
分类:
编程语言 时间:
2015-07-02 01:15:45
阅读次数:
154
1 DECLARE t_error INTEGER DEFAULT 0; 2 DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1; 3 START TRANSACTION; 7 d...
分类:
数据库 时间:
2015-07-01 17:34:03
阅读次数:
178
1 for(p = fmt; *p; p++) 2 { 3 if(*p != '%') 4 { 5 putchar(*p); 6 continue; 7 } 8 i = ...
分类:
其他好文 时间:
2015-07-01 12:02:48
阅读次数:
114
trymysql --force < sample_data.sql Mysql help section says-f, --force Continue even if we get an sql error.----------------------You could also use IN...
分类:
数据库 时间:
2015-07-01 09:47:03
阅读次数:
146
#-*-coding:utf-8-*-
importsys
user="wangru"
counter=0
whileTrue:
ifcounter<3:
name=raw_input("pleaseinputyourname:").strip()
iflen(name)==0:
print"thenameisnull,tryagain"
continue
elifname==user:
pass
else:
print"theuser%sisnotrighttryagain"%name
coun..
分类:
编程语言 时间:
2015-07-01 06:24:31
阅读次数:
163