LeetCode
qq_1925620345
这个作者很懒,什么都没留下…
展开
-
LeetCode940. 不同的子序列
class Solution { public: int distinctSubseqII(string S) { long dp[26]={0},sum=0; long mod=pow(10,9)+7; for(int i=0;i<S.length();i++){ int tmp=dp[S[i]-‘a’]; dp[S[i]-‘a’]=sum+1; sum=(sum+sum+1-tmp+mo...原创 2019-09-13 11:28:40 · 264 阅读 · 0 评论 -
LeetCode943.最短超级串
给定一个字符串数组 A,找到以 A 中每个字符串作为子字符串的最短字符串。 我们可以假设 A 中没有字符串是 A 中另一个字符串的子字符串。 示例 1: 输入:[“alex”,“loves”,“leetcode”] 输出:“alexlovesleetcode” 解释:“alex”,“loves”,“leetcode” 的所有排列都会被接受。 示例 2: 输入:[“catg”,“ctaagt”,“g...原创 2019-09-13 15:58:03 · 253 阅读 · 0 评论