题目链接:点击打开链接
题意:
给定一个长整数
求所有不同的子序列和。
思路:
dp[i]表示以i数字为结尾的序列的和
num[i]表示以i数字为结尾的序列个数
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
i...
分类:
其他好文 时间:
2015-01-23 20:10:12
阅读次数:
164
题目大意:给定长度为N的字符串,求出其中不相同子串的个数。
解题思路:每一个字串一定是某个后缀的前缀,那么原问题就可以等价于求所有后缀之间的不相同的前缀的个数。如果所有的后缀按照suffix(sa[1]),suffix(sa[2])……suffix(sa[n])的顺序计算,我们会发现对于每个新加进来的后缀suffix(sa[k]),它将产生n-sa[k]+1个新的前缀。但是其中有leight[k...
分类:
编程语言 时间:
2015-01-22 20:18:15
阅读次数:
276
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2015-01-22 19:53:56
阅读次数:
168
Copied fromhttps://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/SELECT DISTINCT CategoryId ,ProductNamesFROM ...
分类:
数据库 时间:
2015-01-22 19:37:49
阅读次数:
178
Given a string, find the length of the longest substring T that contains at most 2 distinct characters.For example, Given s = “eceba”,T is "ece" which...
分类:
其他好文 时间:
2015-01-22 14:52:17
阅读次数:
134
HibernateTemplate distinct new object
分类:
Web程序 时间:
2015-01-22 11:00:21
阅读次数:
179
1删除数组条目中重复的条目(可能有多个),返回值是一个包含被删除的重复条目的新数组。var arr = ['a','a','a','a','b','c','d','b','a','e'];Array.prototype.distinct = function(){ var ret = []; ...
分类:
编程语言 时间:
2015-01-21 17:57:14
阅读次数:
238
Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is...
分类:
其他好文 时间:
2015-01-20 15:07:57
阅读次数:
164
该函数返回带有来自一个组的连接的非NULL值的字符串结果。该函数是一个增强的Sybase SQL Anywhere支持的基本LIST()函数。语法结构:GROUP_CONCAT([DISTINCT] expr [,expr ...] [ORDER BY {unsigned_integer | col...
分类:
数据库 时间:
2015-01-20 10:18:42
阅读次数:
190
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.
...
分类:
其他好文 时间:
2015-01-19 21:08:13
阅读次数:
210