add solution for distinct subsequences (dynamic programming)