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-10-15 19:24:01
阅读次数:
168
[leetcode]Given a string S and a string T, count the number of distinct subsequences of T in S....
分类:
其他好文 时间:
2014-10-15 13:53:50
阅读次数:
147
二分+前缀和法
满足条件的子序列长度在(0,n)之间,sum[x+i]-sum[i]为从从第i个元素开始序列长度为x的元素的和。前缀和可在O(n)的时间内统计
sum[i]的值。再用二分找出满足条件的最小的子序列长度。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2014-10-15 00:09:19
阅读次数:
251
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?
//第一种解法
class Solution {
pub...
分类:
其他好文 时间:
2014-10-13 23:41:27
阅读次数:
393
对于List的All,Any,Where,FirstOrDefault,Average,Sum,Distinct,Union,AddRange,RemoveRange,InsertRange,GetRange操作
对于List的All,Any,Where,FirstOrDefault,Average,Sum,Distinct,Union,AddRange,RemoveRange,InsertRange,GetRange操作
分类:
其他好文 时间:
2014-10-13 20:19:57
阅读次数:
291
distinct(str)函数是用来去掉重复记录的,但是它只是针对某一个字段可以去重复。例如:select distinct(name)from tablename; 但是如果想把其他字段值的记录也查询出来,我一开始想的是使用select distinct(name) ,ta.* from tabl...
分类:
数据库 时间:
2014-10-13 18:34:11
阅读次数:
271
鏈接: http://poj.org/problem?id=1458
Description:
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z =...
分类:
其他好文 时间:
2014-10-13 16:43:09
阅读次数:
257
Common Subsequence
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 39009
Accepted: 15713
Description
A subsequence of a given sequence is the given sequenc...
分类:
其他好文 时间:
2014-10-13 15:02:29
阅读次数:
213
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 exa...
分类:
其他好文 时间:
2014-10-12 18:17:08
阅读次数:
242
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...
分类:
其他好文 时间:
2014-10-12 16:58:58
阅读次数:
248