Solve Distinct Subsequences from LeetCode. Given strings and , count distinct subsequences of that equal . This is counting DP. = ways to form from .
If characters match, you can use it or skip it. If they don't match, you must skip. Work through examples by hand before coding. Understanding the pattern makes implementation simple. Practice with similar problems to reinforce your understanding.