Given a string S and a string T, count the number of distinct subsequences ofT inS. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative po…
Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a string S is obtained by deleting 0 or more characters from S. A sequence is palindromic if it is equal…
Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a string S is obtained by deleting 0 or more characters from S. A sequence is palindromic if it is equal…
最长上升子序列的O(n*log(n))算法. 不上升子序列的个数等于最长上升子序列的长度. #include<string.h> #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; #define INF 9999999 int dp[10001]; int num[10001]; int num2[10001]; int tops; int dos(in…