5 lines Python Solution O(nm) time O(n) space

```
def numDistinct(self, s, t):
dp = [1] + [0] * len(t)
for (c, i) in ((cx, ix) for cx in s for ix in xrange(len(t), 0, -1)):
if c == t[i-1]:
dp[i] += dp[i-1]
return dp[len(t)]
```