All test cases not getting passed
Count Subsequences DP
@Bansaljatin05 Your logic is absolutely correct, but you are missing on applying the Modular Arithmetic, like in your case:-
dp[i] = (dp[i]%mod - dp[arr[str[i-1]]%mod + mod)%mod
also, dp[i] = (2 * dp[i-1])%mod
mod is added in the first case because there may be a chance when dp[i] may be already done modulo bcoz of which it is less and difference may be negative, so for taking modulo of negative like (-2)%5 we just need to add (-2 + 5)%5 so that valid answer comes out.
Try submitting it after doing these modification, it will surely pass.
Hope it helps.
Thankyou sooo Much all test cases passed