
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
For each index i, store the frequency of each character in the ith row.
Use dynamic programing to calculate the number of ways to get the target string using the frequency array.