最近看Vamei的Python文章,其中一篇讲异常处理的,原本看完没啥疑惑,或许是自己想的简单了。看到评论,一个园友的问题引起我的兴趣。他的问题是def func(x): try: return ++x finally: return x+1print fun...
分类:
编程语言 时间:
2014-06-15 06:47:20
阅读次数:
228
Description:GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1],...
分类:
其他好文 时间:
2014-06-15 06:33:57
阅读次数:
216
$_format = function (source, params) { if (arguments.length == 1) return function () { var args = $.makeArray(arguments); ...
分类:
Web程序 时间:
2014-06-15 00:28:21
阅读次数:
312
Question:Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].-----...
分类:
其他好文 时间:
2014-06-14 22:59:14
阅读次数:
211
Spiral Matrix:Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:...
分类:
其他好文 时间:
2014-06-14 21:42:10
阅读次数:
309
Subsets Description:Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solu...
分类:
其他好文 时间:
2014-06-14 20:14:56
阅读次数:
267
Description:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next ...
分类:
其他好文 时间:
2014-06-14 18:41:40
阅读次数:
265
void dfs(int k,int target,vector& candidates,vector& sol,vector >& res){ if(target==0){ vector temp(sol); res.push_back(temp); return; }else if(tar...
分类:
其他好文 时间:
2014-06-14 10:31:07
阅读次数:
196
通过酷6的一个转发接口,使用java正则来获取匹配酷6网大部分视频网址链接,抓取获得ip、flash、title等属性用于内嵌视频展示;关键代码是抓取数据,展示代码很简单。
1.抓取数据代码:
/**
* 酷6新接口方法
* add by yangkai
* @param videoUrl
* @return
*/
prot...
分类:
其他好文 时间:
2014-06-14 10:18:45
阅读次数:
367
//在外面加一圈非0,再广搜
#include
#include
using std::queue;
int t, w, h, arr[962][1442];
int mov[][2] = {-1, 0, 0, 1, 1, 0, 0, -1};
queue Q;
bool check(int x, int y){
if(x h + 1 || y > w + 1)
return 0;...
分类:
其他好文 时间:
2014-06-14 10:06:32
阅读次数:
276