Given a set of distinct integers,S, return all
possible subsets.Note: Elements in a subset must be in non-descending order. The
solution set m...
分类:
其他好文 时间:
2014-06-04 20:01:32
阅读次数:
340
本文希望通过简单的总结,把常用的查询方法予以总结,希望能够明确在心主要涵盖:模糊查询、排序、分组、集合函数、TOP、Case包括:Between、In、Like、And、Or、Order
by包括:Group by、Distinct、MAX\MIN、Avg、Count、Sum、Having、Top、...
分类:
数据库 时间:
2014-05-29 23:13:46
阅读次数:
456
转自芙蓉清秀的BLOGhttp://blog.sina.com.cn/liurongxiu1211sql去除重复语句(2012-06-15
15:00:01)sql 单表/多表查询去除重复记录单表distinct多表group bygroup by 必须放在 order by 和
limit之前,不...
分类:
数据库 时间:
2014-05-28 04:00:47
阅读次数:
280
【题目】
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
【题意】
解N皇后问题,N-Queens要求返回所有的解,而本题只需要返回可行解的数目
【思路】
DFS,参考N-Queens...
分类:
其他好文 时间:
2014-05-25 01:51:55
阅读次数:
236
题目
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
解答...
分类:
其他好文 时间:
2014-05-25 00:37:34
阅读次数:
284
It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
Now you are suggested to solve the f...
分类:
其他好文 时间:
2014-05-24 21:52:34
阅读次数:
320
题目:给定三个串str1,str2,str3,判断str3是否是str1,str2的交叉字符串。
交叉字符串:两个字符串的字符交叉,组成新的字符串,要求属于原来字符串中的字符在新的生成的交叉字符串中的顺序与原顺序相同。即若a、b在源字符串中时a在前面,那么在新的字串中时,a也的在b的前面。
回想问题Distinct
Subsequences,其形式表示为 S --通过合理的规则----得到...
分类:
其他好文 时间:
2014-05-24 18:14:24
阅读次数:
284
【题目】
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuratio...
分类:
其他好文 时间:
2014-05-24 17:12:32
阅读次数:
237
最近项目中在用Linq
Distinct想要将重复的资料去除时,发现它跟Any之类的方法有点不太一样,不能很直觉的在呼叫时直接带入重复数据判断的处理逻辑,所以当我们要用某个成员属性做重复数据的判断时,就必需绕一下路,这边稍微将处理的方法做个整理并记录一下。
首先为了方便接下去说明,我们必须先来准备后...
分类:
其他好文 时间:
2014-05-24 09:24:04
阅读次数:
263
问题:给定两个字符串S,T,对于S,可以删除其中的任意多个(包括0)字符,使其得到T。问有多少种删法可以得到T。
举例分析:
S:ababa
T: aba
dp[i][j] : 表示 S 从0 ~ i - 1,T从0~j - 1,所得到的方法数。i,j 表示长度。
初始条件:dp[i][0] = 1,T为空串,而空串总是任意串的字串。即,将S串的所有字符都删掉,就得到T。
状态转移...
分类:
其他好文 时间:
2014-05-23 00:54:13
阅读次数:
247