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 must not co...
分类:
其他好文 时间:
2014-11-13 09:19:23
阅读次数:
220
Climbing StairsYou are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct way...
分类:
其他好文 时间:
2014-11-12 16:24:33
阅读次数:
226
问题描述:
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 must not contain duplicate subsets.
For ex...
分类:
其他好文 时间:
2014-11-12 11:46:52
阅读次数:
169
SQL常用语句: 一、常用关键词:1.distinct:过滤重复select distinct create_user_name from bms_project; 此种情况下,就要用到distinct过滤掉重复的。2.count: 统计select count(*) from bms_projec...
分类:
数据库 时间:
2014-11-12 11:46:20
阅读次数:
237
由于Lambda Distinct方法默认是按照集合里面的值比较的,所以当集合里面存放的是类的时候,我们一般是按照实体中的某一属性值比较,其实是用默认的Distinct也可以的,自己先定义一个实现了接口IEqualityComparer的类,然后调用Distinct的重载将这个类传递进去,但是这样太...
分类:
其他好文 时间:
2014-11-11 20:46:02
阅读次数:
198
0 order by asc/desc 默认升序 order by 列的名字|表达式|别名|序号 把空放在后边:order by desc nulls last1分组函数--会自动滤空值 count(*|distinct|clumn) max min sum avg select s...
分类:
数据库 时间:
2014-11-10 21:21:06
阅读次数:
354
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.
E...
分类:
其他好文 时间:
2014-11-10 20:00:33
阅读次数:
193
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
思路1:打表
public class Solution {
public int totalNQ...
分类:
其他好文 时间:
2014-11-10 19:58:54
阅读次数:
220
一开始第一反映是用暴搜+回溯剪枝,妥妥的超时,见numDistinct0函数。
后来想到这跟公共子串有点类似,满足最优子结构和重叠问题,因此可用DP。
状态转移方程如下:
{ dp[i-1,j-1]+dp[i-1][j] , 当s[i]==s[j],0
dp[i,j]={ dp[i-1][j], 当s[i]!=s[j] ,0
...
分类:
其他好文 时间:
2014-11-09 23:51:47
阅读次数:
256
http://zhangzhaoaaa.iteye.com/blog/1689412参考:《MYSQL技术内幕SQL编程》select distinct from lefttablejoin on wheregroup bywith{CUBE|ROLLUP}HAVINGorder bylimit处理...
分类:
数据库 时间:
2014-11-09 11:03:52
阅读次数:
145