博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Distinct Subsequences
阅读量:4658 次
发布时间:2019-06-09

本文共 634 字,大约阅读时间需要 2 分钟。

Given a string S and a string T, count the number of distinct subsequences of T in S.

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 positions of the remaining characters. (ie, "ACE" is a subsequence of "ABCDE" while "AEC" is not).

Here is an example:

S = "rabbbit", T = "rabbit"

Return 3.

class Solution {public:    int numDistinct(string s, string t) {        int l1 = s.length();        int l2 = t.length();                int dp[l1+1][l2+1];        for(int i=0;i

 

转载于:https://www.cnblogs.com/wxquare/p/5903421.html

你可能感兴趣的文章
IntelliJ IDEA 的Project structure说明
查看>>
Java Security(JCE基本概念)
查看>>
创建 PSO
查看>>
JasperReport报表设计4
查看>>
项目活动定义 概述
查看>>
团队冲刺04
查看>>
我的Python分析成长之路8
查看>>
泛型在三层中的应用
查看>>
SharePoint2010 -- 管理配置文件同步
查看>>
.Net MVC3中取得当前区域的名字(Area name)
查看>>
获得屏幕像素以及像素密度
查看>>
int与string转换
查看>>
adb命令 判断锁屏
查看>>
推荐一个MacOS苹果电脑系统解压缩软件
查看>>
1035等差数列末项计算
查看>>
CDMA鉴权
查看>>
ASP.NET MVC Identity 兩個多個連接字符串問題解決一例
查看>>
过滤器与拦截器区别
查看>>
第二阶段站立会议7
查看>>
JAVA多线程
查看>>