专栏名称: 每日一道算法题
学习算法是一种信仰,每天都需要坚持!
目录
相关文章推荐
奇舞精选  ·  机器学习中的 One-Hot 编码 ·  昨天  
算法爱好者  ·  一 90 后程序员杀入 A 股,进场四天亏 ... ·  3 天前  
沉默王二  ·  见证历史,75K确实可以封神了 ·  6 天前  
沉默王二  ·  见证历史,75K确实可以封神了 ·  6 天前  
九章算法  ·  寻找一个leetcode刷题搭子 ·  1 周前  
九章算法  ·  《LeetCode押题宝典.pdf》白嫖,进 ... ·  1 周前  
51好读  ›  专栏  ›  每日一道算法题

115. Distinct Subsequences

每日一道算法题  · 公众号  · 算法  · 2017-08-06 09:01

正文

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


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. (i.e., “ACE” is a subsequence of “ABCDE” while “AEC” is not).


Here is an example:

S = “rabbbit”, T = “rabbit”


Return 3.


提示提交代码后需要用简洁的语言解释一下代码思路~ 谢谢


历史题目和总结见公众号「每日一道算法题」


https://leetcode.com/problems/distinct-subsequences/description/