Leetcode - Arrays | Distinct Subsequences
115. Distinct Subsequences[H]
https://leetcode.com/problems/distinct-subsequences/
Description
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. (ie, "ACE" is a subsequence of "ABCDE" while "AEC" is not).
It’s guaranteed the answer fits on a 32-bit signed integer.
Example 1:
1 | Input: S = "rabbbit", T = "rabbit" |
Example 2:
1 | Input: S = "babgbag", T = "bag" |
Solution
https://discuss.leetcode.com/topic/51131/space-o-mn-and-o-n-python-solutions
1 |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment





