由于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
1、查询数据库中的表空间名称1)查询所有表空间select tablespace_name from dba_tablespaces;select tablespace_name from user_tablespaces;2)查询使用过的表空间select distinct tablespace_...
分类:
其他好文 时间:
2014-11-09 06:12:58
阅读次数:
361
题目意思:
http://poj.org/problem?id=1458
给出两个字符串,求出这两个字符串的最长子序列的长度,最长子序列的定义如下:
Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increasing sequence of ind...
分类:
其他好文 时间:
2014-11-08 23:39:50
阅读次数:
296
Smallest Difference
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 4639
Accepted: 1290
Description
Given a number of distinct decimal digits, you can fo...
分类:
其他好文 时间:
2014-11-08 16:44:18
阅读次数:
284
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159解题思路:任意先给出两个字符串 abcfbc abfcab,用dp[i][j]来记录当前最长的子序列,则如果有x[i]与y[j]相等的话,则相当于公共子序列的长度在dp[i-1][j-1]上增加1,...
分类:
其他好文 时间:
2014-11-08 00:52:18
阅读次数:
312